:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #667384;
  --line: #d6e0e7;
  --soft: #f4f8fa;
  --panel: #ffffff;
  --panel-tint: #fbfefe;
  --teal: #0f7280;
  --teal-dark: #075866;
  --teal-soft: #e7f6f5;
  --copper: #b86b23;
  --amber: #b45309;
  --steel: #60758a;
  --red: #b42318;
  --green: #177245;
  --blue: #256f9f;
  --violet: #6454a3;
  --shadow-sm: 0 1px 2px rgba(18, 39, 54, 0.05);
  --shadow-md: 0 12px 28px rgba(18, 39, 54, 0.09);
  --shadow-card: 0 6px 18px rgba(18, 39, 54, 0.07);
  --button-lift: 0 10px 18px rgba(18, 39, 54, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #eef6f7 0, #f7fafb 320px, #eef4f6 100%);
  color: var(--ink);
  font-family: "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 36px 24px;
  background:
    linear-gradient(90deg, rgba(15, 114, 128, 0.08), rgba(255, 255, 255, 0) 42%),
    #ffffff;
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--teal), #3c8f7a 42%, var(--copper));
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: clamp(220px, 24vw, 330px);
  height: auto;
  max-height: 72px;
  object-fit: contain;
  object-position: left center;
  flex: 0 0 auto;
}

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: 0;
  white-space: nowrap;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.3;
}

h3 {
  margin-bottom: 10px;
  font-size: 16px;
}

.status {
  min-width: 112px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfc;
  text-align: center;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.status.ok {
  color: var(--green);
  background: #ecfdf3;
  border-color: #badbcc;
}

.status.fail {
  color: var(--red);
  background: #fff1f0;
  border-color: #ffd0cb;
}

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 0.9fr);
  gap: 22px;
  padding: 24px 32px;
}

.panel,
.log-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow-md);
}

.input-panel,
.result-panel {
  min-height: 620px;
}

.input-panel {
  border-top: 3px solid rgba(15, 114, 128, 0.72);
}

.result-panel {
  border-top: 3px solid rgba(184, 107, 35, 0.72);
}

.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid #edf2f5;
}

.panel-title span {
  color: var(--muted);
  font-size: 13px;
}

.key-node {
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.key-node-teal {
  color: var(--teal-dark);
  text-decoration-color: rgba(15, 114, 128, 0.32);
}

.key-node-amber {
  color: var(--amber);
  text-decoration-color: rgba(180, 83, 9, 0.32);
}

.key-node-blue {
  color: var(--blue);
  text-decoration-color: rgba(37, 111, 159, 0.32);
}

.key-node-green {
  color: var(--green);
  text-decoration-color: rgba(23, 114, 69, 0.32);
}

.key-node-violet {
  color: var(--violet);
  text-decoration-color: rgba(100, 84, 163, 0.32);
}

.status-message {
  margin: 10px 0 0;
  line-height: 1.7;
}

.status-message.muted {
  color: var(--muted);
}

.status-message.success {
  color: var(--green);
}

.status-message.warning {
  color: var(--amber);
}

.status-message.error {
  color: var(--red);
}

.source-status {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 6px;
  background: #fbfdfe;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
}

.source-status.success {
  color: var(--green);
  background: #effaf4;
  border-color: #b8dfc8;
}

.source-status.warning {
  color: var(--amber);
  background: #fff8ef;
  border-color: #fed7aa;
}

.source-status.muted {
  color: var(--muted);
}

.intake-quality {
  display: grid;
  gap: 8px;
  margin: -4px 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  font-size: 14px;
}

.intake-quality[hidden] {
  display: none;
}

.intake-quality-high {
  border-color: #b8dfc8;
  border-left-color: var(--green);
  background: #f5fcf7;
}

.intake-quality-medium {
  border-color: #fed7aa;
  border-left-color: var(--amber);
  background: #fffaf2;
}

.intake-quality-low {
  border-color: #fecaca;
  border-left-color: var(--red);
  background: #fff7f7;
}

.intake-quality strong {
  font-size: 15px;
}

.intake-quality-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.intake-quality-facts span {
  padding: 4px 8px;
  border: 1px solid rgba(102, 115, 132, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.intake-quality-note,
.intake-quality-next {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.intake-quality-next {
  color: var(--ink);
  font-weight: 700;
}

.intake-quality-preview {
  margin: 2px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(102, 115, 132, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: #334155;
  font: 14px/1.65 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  max-height: 170px;
  overflow: auto;
  white-space: pre-wrap;
}

.workflow-card {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid #d3e2e8;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: rgba(251, 253, 255, 0.94);
  box-shadow: 0 16px 36px rgba(18, 39, 54, 0.14);
  backdrop-filter: blur(10px);
}

.workflow-card-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.workflow-card-title h3 {
  margin-bottom: 0;
  font-size: 16px;
}

.workflow-card-title span {
  color: var(--muted);
  font-size: 13px;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow-step {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.workflow-step-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.workflow-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #edf4f7;
  color: var(--steel);
  font-size: 12px;
  font-weight: 800;
}

.workflow-step-title {
  min-width: 0;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.3;
}

.workflow-step-detail {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.workflow-step.complete {
  border-color: #b8dfc8;
  background: #f3fbf6;
}

.workflow-step.complete .workflow-step-number {
  color: #ffffff;
  background: var(--green);
}

.workflow-step.ready {
  border-color: #b7d5ea;
  background: #f4f9fd;
}

.workflow-step.ready .workflow-step-number {
  color: #ffffff;
  background: var(--blue);
}

.workflow-step.warning {
  border-color: #fed7aa;
  background: #fff8ef;
}

.workflow-step.warning .workflow-step-number {
  color: #ffffff;
  background: var(--amber);
}

.workflow-step.locked {
  opacity: 0.72;
  background: #f8fafb;
}

@media (max-width: 1100px) {
  .workflow-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .workflow-steps {
    grid-template-columns: 1fr;
  }
}

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

.actions {
  padding-top: 4px;
}

.primary-upload {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.upload-choice-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.primary-upload-button {
  justify-self: start;
  background: linear-gradient(180deg, #16899a, var(--teal-dark));
  border-color: #0c6572;
  color: #ffffff;
  box-shadow: 0 12px 20px rgba(15, 114, 128, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.primary-upload-button:hover {
  background: linear-gradient(180deg, #1b96a8, #07515e);
  box-shadow: 0 14px 24px rgba(15, 114, 128, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.notification-upload-button {
  color: #753f0b;
  background: linear-gradient(180deg, #fff4df, #ffdba7);
  border-color: #e8ad5e;
  box-shadow: 0 10px 18px rgba(184, 107, 35, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.notification-upload-button:hover {
  background: linear-gradient(180deg, #fff8ea, #f6c67d);
  border-color: #d98a24;
  box-shadow: 0 12px 22px rgba(184, 107, 35, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.template-download-button {
  color: #284d6a;
  background: linear-gradient(180deg, #f2f8ff, #dcecf8);
  border-color: #b7d5ea;
  box-shadow: 0 10px 18px rgba(37, 111, 159, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.template-download-button:hover {
  background: linear-gradient(180deg, #f8fcff, #cfe6f5);
  border-color: #8ebedb;
  box-shadow: 0 12px 22px rgba(37, 111, 159, 0.19), inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.file-button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff, #f7fafc);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--button-lift);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.upload-choice-row .file-button {
  width: 100%;
  min-width: 0;
  padding: 9px 12px;
  font-size: 16px;
  line-height: 1.2;
  white-space: nowrap;
}

.upload-choice-row .icon {
  width: 17px;
  height: 17px;
}

.icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: currentColor;
}

.icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.file-button input {
  display: none;
}

.file-button.primary-upload-button {
  background: linear-gradient(180deg, #16899a, var(--teal-dark));
  border-color: #0c6572;
  color: #ffffff;
  box-shadow: 0 12px 20px rgba(15, 114, 128, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.file-button.primary-upload-button:hover {
  background: linear-gradient(180deg, #1b96a8, #07515e);
  color: #ffffff;
  box-shadow: 0 14px 24px rgba(15, 114, 128, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.file-button.notification-upload-button {
  color: #753f0b;
  background: linear-gradient(180deg, #fff4df, #ffdba7);
  border-color: #e8ad5e;
  box-shadow: 0 10px 18px rgba(184, 107, 35, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.file-button.notification-upload-button:hover {
  color: #653407;
  background: linear-gradient(180deg, #fff8ea, #f6c67d);
  border-color: #d98a24;
  box-shadow: 0 12px 22px rgba(184, 107, 35, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.file-button.template-download-button {
  color: #284d6a;
  background: linear-gradient(180deg, #f2f8ff, #dcecf8);
  border-color: #b7d5ea;
  box-shadow: 0 10px 18px rgba(37, 111, 159, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.file-button.template-download-button:hover {
  color: #1e405d;
  background: linear-gradient(180deg, #f8fcff, #cfe6f5);
  border-color: #8ebedb;
  box-shadow: 0 12px 22px rgba(37, 111, 159, 0.19), inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

button.primary {
  background: linear-gradient(180deg, #16899a, var(--teal-dark));
  border-color: #0c6572;
  color: #ffffff;
  box-shadow: 0 14px 24px rgba(15, 114, 128, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

button.primary:hover {
  background: linear-gradient(180deg, #1c95a6, #07515e);
}

button.secondary:hover,
.file-button:hover {
  background: #f7fbfc;
  border-color: #a9c9d2;
  box-shadow: var(--shadow-card);
}

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

button.primary:disabled {
  background: linear-gradient(180deg, #b8c8cd, #9dafb5);
  border-color: #8aa6ad;
  box-shadow: none;
}

textarea {
  width: 100%;
  min-height: 220px;
  margin: 14px 0;
  padding: 14px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  color: var(--ink);
  font-family: Consolas, "Microsoft JhengHei", monospace;
  font-size: 13px;
  line-height: 1.6;
}

.hidden-technical-field {
  display: none;
}

.case-picker {
  display: grid;
  gap: 10px;
  margin: 16px 0 20px;
  padding: 16px;
  border: 1px solid #e0e8ed;
  border-radius: 8px;
  background: #fbfdfe;
}

.case-picker label {
  font-weight: 700;
}

.case-picker select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  box-shadow: inset 0 1px 2px rgba(18, 39, 54, 0.04);
}

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

#saveCaseButton {
  color: #1c5f43;
  background: linear-gradient(180deg, #f2fff8, #d9f3e5);
  border-color: #b9dfc9;
}

#saveCaseButton:hover {
  border-color: #7fbea0;
  background: linear-gradient(180deg, #f8fffb, #cbead9);
}

.report-source-card {
  margin: 18px 0 16px;
  padding: 16px;
  border: 1px solid #d5e2e7;
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfeff, #f7fbfc);
  box-shadow: var(--shadow-card);
}

.report-source-item {
  background: #ffffff;
}

.source-dropdown-toggle {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
}

.source-dropdown-toggle:hover {
  border-color: #9fc5cf;
  background: #f7fbfc;
}

.source-dropdown-arrow {
  flex: 0 0 auto;
  color: var(--teal);
  font-size: 18px;
}

.source-dropdown-menu {
  margin-top: 8px;
  padding: 12px;
  border: 1px solid #d5e2e7;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(18, 39, 54, 0.11);
}

.source-dropdown-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}

button.small {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 14px;
}

.source-list-scroll {
  max-height: 320px;
  overflow: auto;
  padding-right: 2px;
}

.source-list-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.source-list-title span {
  color: var(--muted);
  font-size: 13px;
}

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

.source-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.source-item:hover {
  border-color: #a9c9d2;
  background: #fbfeff;
  box-shadow: var(--shadow-sm);
}

.source-item input {
  margin-top: 3px;
}

.source-item strong {
  display: block;
  margin-bottom: 3px;
}

.source-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.plan-card {
  display: grid;
  gap: 12px;
  margin: 18px 0 20px;
  padding: 16px;
  border: 1px solid #cddce3;
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfefe, #f7fbfb);
  box-shadow: var(--shadow-card);
}

.plan-card-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.plan-card-title h3 {
  margin-bottom: 4px;
  font-size: 16px;
}

.plan-card-title .note {
  margin-bottom: 0;
}

.plan-card-badge {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid #b7d8d5;
  border-radius: 999px;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 12px;
  font-weight: 700;
}

.plan-dropdown-toggle {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
}

.plan-dropdown-toggle:hover {
  border-color: #9fc5cf;
  background: #f7fbfc;
}

.plan-dropdown-menu {
  margin-top: 8px;
  padding: 12px;
  border: 1px solid #d5e2e7;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(18, 39, 54, 0.11);
}

.plan-stage-list {
  display: grid;
  gap: 6px;
}

.plan-stage-header,
.plan-stage-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 140px 140px;
  gap: 10px;
  align-items: center;
}

.plan-stage-header {
  padding: 0 10px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.plan-stage-row {
  padding: 10px;
  border: 1px solid #d9e5ea;
  border-radius: 6px;
  background: #ffffff;
}

.plan-stage-row strong {
  color: var(--ink);
  font-size: 14px;
}

.plan-stage-row input {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

.plan-stage-row input:focus {
  outline: 2px solid rgba(0, 109, 119, 0.18);
  border-color: var(--teal);
}

button.danger {
  color: var(--red);
  border-color: #f3c7c2;
  background: linear-gradient(180deg, #fff9f8, #ffe5e1);
}

button.danger:hover {
  background: linear-gradient(180deg, #fff5f3, #ffd7d0);
  border-color: #efaaa2;
}

.advanced-panel {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.advanced-panel summary,
.log-panel summary {
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.advanced-panel .file-row {
  margin-top: 12px;
}

.mode-row {
  margin-top: 12px;
  color: var(--muted);
  padding: 10px 2px 0;
}

#validateButton {
  color: #254c6d;
  background: linear-gradient(180deg, #ffffff, #e4f0f8);
  border-color: #b8d5e8;
  box-shadow: 0 10px 18px rgba(37, 111, 159, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

#validateButton:hover {
  color: #153c5c;
  border-color: #8ebbd7;
  background: linear-gradient(180deg, #ffffff, #d3e8f6);
}

#generateButton {
  min-width: 190px;
  font-size: 17px;
}

#generateButton:not(:disabled):hover {
  transform: translateY(-1px);
}

.actions button:active,
.file-button:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-sm);
}

.mode-row label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid #d9e5ea;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 251, 252, 0.94)),
    repeating-linear-gradient(90deg, transparent, transparent 23px, rgba(15, 114, 128, 0.035) 24px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), var(--shadow-card);
}

.summary-card {
  position: relative;
  display: block;
  width: 100%;
  min-height: 112px;
  padding: 18px 44px 16px 18px;
  border: 1px solid rgba(214, 224, 231, 0.9);
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff, #f6fafb);
  text-align: left;
  font-weight: 400;
  box-shadow: inset 4px 0 0 #d7e1e7, var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.summary-card::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 12px;
  height: 3px;
  border-radius: 99px;
  background: #dbe6ec;
}

.summary-icon {
  position: absolute;
  top: 15px;
  right: 14px;
  display: inline-flex;
  width: 28px;
  height: 28px;
  padding: 5px;
  border-radius: 50%;
  background: #f1f6f7;
  color: #64748b;
  opacity: 0.9;
}

.summary-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#eventSummaryCard {
  box-shadow: inset 4px 0 0 var(--teal), 0 12px 22px rgba(15, 114, 128, 0.11);
}

#eventSummaryCard .summary-icon,
#eventSummaryCard small {
  color: var(--teal);
}

#eventSummaryCard::after {
  background: linear-gradient(90deg, var(--teal), #8ccfc9);
}

#warningSummaryCard {
  box-shadow: inset 4px 0 0 var(--copper), 0 12px 22px rgba(184, 107, 35, 0.12);
}

#warningSummaryCard .summary-icon,
#warningSummaryCard small {
  color: var(--copper);
}

#warningSummaryCard::after {
  background: linear-gradient(90deg, var(--copper), #f1bd75);
}

#blockingSummaryCard {
  box-shadow: inset 4px 0 0 var(--steel), 0 12px 22px rgba(96, 117, 138, 0.12);
}

#blockingSummaryCard .summary-icon,
#blockingSummaryCard small {
  color: var(--steel);
}

#blockingSummaryCard::after {
  background: linear-gradient(90deg, var(--steel), #aebdca);
}

.summary-card:hover {
  border-color: #b8c8d2;
  background: linear-gradient(180deg, #ffffff, #f1f8f9);
  box-shadow: inset 4px 0 0 var(--teal), 0 16px 28px rgba(18, 39, 54, 0.13);
}

.summary-grid strong {
  display: block;
  margin-bottom: 5px;
  font-size: 30px;
  line-height: 1.15;
}

.summary-grid span,
.summary-card small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.summary-card small {
  margin-top: 3px;
  color: var(--teal);
  font-weight: 700;
}

.notification-mode .summary-card {
  background: #fbfdff;
}

.notification-mode #eventSummaryCard {
  box-shadow: inset 4px 0 0 var(--teal);
}

.notification-mode #eventSummaryCard .summary-icon {
  color: var(--teal);
}

.notification-mode #warningSummaryCard {
  box-shadow: inset 4px 0 0 #d97706;
}

.notification-mode #warningSummaryCard .summary-icon {
  color: #d97706;
}

.notification-mode #blockingSummaryCard {
  box-shadow: inset 4px 0 0 #94a3b8;
}

.notification-mode #warningSummaryCard strong,
.notification-mode #blockingSummaryCard strong {
  font-size: 21px;
}

.summary-detail {
  margin: -2px 0 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfe;
  box-shadow: var(--shadow-sm);
}

.summary-detail-title {
  display: block;
  margin-bottom: 8px;
}

.event-detail-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.validation-issue-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
}

.validation-issue-list li {
  padding: 8px 0 10px;
  border-bottom: 1px solid #e4eef2;
}

.validation-issue-list li:last-child {
  border-bottom: 0;
}

.event-detail-heading {
  font-weight: 800;
}

.event-detail-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 14px;
}

.summary-next-step {
  margin-bottom: 0;
  color: var(--ink);
}

.prompt-area,
.output-area {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.prompt-area ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.prompt-area li {
  margin-bottom: 10px;
  line-height: 1.55;
}

.prompt-meta,
.prompt-preview,
.prompt-action {
  margin-top: 3px;
  color: var(--ink);
  font-size: 14px;
}

.prompt-meta {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
}

.prompt-preview {
  color: var(--muted);
}

.prompt-action {
  color: var(--teal);
}

.prompt-area li.blocking {
  color: var(--red);
}

.prompt-area li.warning {
  color: var(--amber);
}

.muted,
.note {
  color: var(--muted);
}

.notice-note {
  margin: 10px 0 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 6px;
  background: #fbfcfd;
  line-height: 1.6;
}

.notice-warning {
  color: #9a3412;
  border-color: #fed7aa;
  background: #fff7ed;
}

.notice-info {
  color: #0f5f74;
  border-color: #bae6fd;
  background: #f0f9ff;
}

.notice-success {
  color: var(--green);
  border-color: #bbf7d0;
  background: #f0fdf4;
}

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

.supplemental-box {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid #cfe1e8;
  border-left: 4px solid #256f8f;
  border-radius: 6px;
  background: #f8fcff;
}

.supplemental-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.supplemental-header strong {
  display: block;
  margin-bottom: 4px;
}

.supplemental-header .note {
  margin: 0;
  line-height: 1.55;
}

.supplemental-summary {
  flex: 0 0 auto;
  padding: 4px 9px;
  border: 1px solid #b9d6e2;
  border-radius: 999px;
  background: #ffffff;
  color: #1b5f7d;
  font-size: 13px;
  font-weight: 700;
}

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

.supplemental-button {
  justify-content: center;
  min-height: 52px;
  padding: 10px 12px;
  border-left-width: 5px;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 8px 18px rgba(18, 39, 54, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.supplemental-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(18, 39, 54, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.supplemental-location {
  color: #075f64;
  border-color: #b9dce2;
  border-left-color: #0f8792;
  background: linear-gradient(180deg, #f3fcfd, #e6f6f8);
}

.supplemental-location:hover {
  border-color: #8bc8d0;
  border-left-color: #0f8792;
  background: linear-gradient(180deg, #f9feff, #ddf1f4);
}

.supplemental-qualification {
  color: #7d4c00;
  border-color: #edd2a4;
  border-left-color: #c97513;
  background: linear-gradient(180deg, #fffaf1, #fff0d6);
}

.supplemental-qualification:hover {
  border-color: #e2ba77;
  border-left-color: #c97513;
  background: linear-gradient(180deg, #fffdf8, #ffe9c3);
}

.supplemental-interview {
  color: #314f72;
  border-color: #c8d8e8;
  border-left-color: #54789d;
  background: linear-gradient(180deg, #f6fbff, #eaf2fb);
}

.supplemental-interview:hover {
  border-color: #a8c2dc;
  border-left-color: #54789d;
  background: linear-gradient(180deg, #fbfdff, #e0edf9);
}

.supplemental-evidence {
  color: #4d3f7d;
  border-color: #d7cfe9;
  border-left-color: #7360a8;
  background: linear-gradient(180deg, #fbf8ff, #f0ebfa);
}

.supplemental-evidence:hover {
  border-color: #bfb2dd;
  border-left-color: #7360a8;
  background: linear-gradient(180deg, #fdfbff, #e9e2f6);
}

.supplemental-button-disabled,
.supplemental-button-disabled:hover {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.supplemental-recommendations {
  padding: 10px 12px;
  border: 1px solid #d9e6ec;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
}

.supplemental-recommendations:empty {
  display: none;
}

.supplemental-recommendations strong {
  display: block;
  margin-bottom: 6px;
}

.supplemental-recommendations ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 1.2em;
  color: var(--muted);
  line-height: 1.5;
}

.supplemental-list {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.supplemental-list .supplemental-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid #d9e6ec;
  border-radius: 6px;
  background: #ffffff;
}

.supplemental-list .supplemental-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.supplemental-delete-button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 5px 10px;
  font-size: 13px;
  box-shadow: none;
}

.supplemental-delete-button .icon {
  width: 15px;
  height: 15px;
}

.output-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfe;
  box-shadow: var(--shadow-sm);
}

.output-card-ready {
  border-color: #a8dec0;
  border-left: 5px solid var(--green);
  background: #f3fcf6;
  box-shadow: 0 8px 20px rgba(23, 114, 69, 0.12);
}

.output-card-ready strong {
  color: #123326;
  font-size: 17px;
}

.output-card-warning {
  align-items: flex-start;
  flex-direction: column;
  border-color: #fed7aa;
  border-left: 4px solid #d97706;
  background: #fff8ef;
  line-height: 1.65;
}

.output-card-warning strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.output-card a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid var(--teal-dark);
  border-radius: 6px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--button-lift);
  white-space: nowrap;
}

.output-card a:hover {
  background: var(--teal-dark);
}

.output-card a svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.3;
}

.output-card-warning a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #b8d7d7;
  border-radius: 6px;
  background: #ffffff;
  color: var(--teal);
  box-shadow: none;
}

.output-card-warning a:hover {
  border-color: var(--teal);
  background: #eefafa;
  color: var(--teal-dark);
}

.log-panel {
  margin: 0 32px 24px;
  box-shadow: var(--shadow-sm);
}

.log-panel[open] {
  background: var(--panel);
}

pre {
  margin-top: 12px;
  max-height: 240px;
  margin: 0;
  overflow: auto;
  padding: 14px;
  border-radius: 6px;
  background: #111827;
  color: #e5e7eb;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
}

@media (max-width: 920px) {
  .topbar,
  .layout {
    padding-left: 16px;
    padding-right: 16px;
  }

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

  .brand-block {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .brand-logo {
    width: min(280px, 72vw);
    max-height: 60px;
  }

  h1 {
    white-space: normal;
    font-size: 24px;
  }

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

  .upload-choice-row {
    grid-template-columns: 1fr;
  }

  .log-panel {
    margin-left: 16px;
    margin-right: 16px;
  }

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

  .workflow-card {
    position: static;
    top: auto;
    z-index: auto;
  }

  .supplemental-header {
    flex-direction: column;
  }

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

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

  .output-card .download-word-button {
    width: 100%;
  }
}
