:root {
  --orange: #ed6103;
  --orange-dark: #c94b00;
  --orange-soft: #fff1e7;
  --ink: #18212b;
  --muted: #6f7782;
  --line: #e7e9ec;
  --surface: #ffffff;
  --background: #f5f6f7;
  --success: #16845b;
  --danger: #c63b35;
  --warning: #a66200;
  --shadow: 0 14px 42px rgba(33, 43, 54, 0.08);
  font-family:
    Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 8% -10%, rgba(237, 97, 3, 0.08), transparent 28rem),
    var(--background);
}

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

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 10px max(24px, calc((100vw - 1440px) / 2));
  border-bottom: 1px solid rgba(231, 233, 236, 0.9);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand img {
  width: 136px;
  height: auto;
  object-fit: contain;
}

.brand-divider {
  width: 1px;
  height: 34px;
  margin: 0 18px;
  background: var(--line);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.main-nav {
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 11px;
  background: #f2f3f4;
}

.nav-button {
  padding: 8px 15px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
}

.nav-button:hover,
.nav-button.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(33, 43, 54, 0.08);
}

main {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 38px 0 56px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 26px;
}

.eyebrow {
  color: var(--orange);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.hero h1,
.page-heading h1 {
  margin: 8px 0 7px;
  font-size: clamp(27px, 3vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.hero p {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.hero-badge {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  border: 1px solid #e2e5e8;
  border-radius: 999px;
  color: #545d67;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(22, 132, 91, 0.11);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(390px, 0.84fr) minmax(520px, 1.16fr);
  gap: 22px;
  align-items: start;
}

.card,
.filter-card,
.data-card {
  border: 1px solid rgba(223, 226, 229, 0.96);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card {
  min-height: 610px;
  padding: 25px;
}

.section-heading,
.section-heading > div,
.page-heading,
.page-actions,
.result-toolbar,
.item-heading,
.defect-actions,
.dialog-actions {
  display: flex;
  align-items: center;
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 25px;
}

.section-heading > div {
  gap: 10px;
}

.section-heading h2 {
  margin: 0;
  font-size: 17px;
}

.step {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 8px;
  color: var(--orange);
  background: var(--orange-soft);
  font-size: 11px;
  font-weight: 800;
}

.required-note,
.result-meta {
  color: var(--muted);
  font-size: 11px;
}

.field-label {
  display: block;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
}

.field-label span {
  color: var(--orange);
}

.field-label small {
  margin-left: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #d9dde1;
  border-radius: 9px;
  outline: none;
  color: var(--ink);
  background: #fff;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 205px;
  resize: vertical;
  padding: 14px;
  line-height: 1.65;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(237, 97, 3, 0.1);
}

.report-row {
  position: relative;
}

.report-row input {
  padding-right: 94px;
}

.context-state {
  position: absolute;
  top: 9px;
  right: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--muted);
  background: #f2f3f4;
  font-size: 10px;
}

.context-state.ready {
  color: var(--success);
  background: #e9f7f1;
}

.context-state.error {
  color: var(--danger);
  background: #fff0ef;
}

.field-help,
.textarea-footer,
.form-message {
  color: var(--muted);
  font-size: 11px;
}

.field-help {
  margin: 7px 0 20px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 18px;
  padding: 5px;
  border-radius: 11px;
  background: #f2f3f4;
}

.mode-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 41px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.mode-tab.active {
  color: var(--orange-dark);
  background: white;
  box-shadow: 0 2px 8px rgba(33, 43, 54, 0.08);
}

.mode-icon {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 5px;
  font-size: 10px;
}

.mode-panel {
  display: none;
}

.mode-panel.active {
  display: block;
}

.textarea-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

.dropzone {
  display: flex;
  width: 100%;
  min-height: 225px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 9px;
  border: 1px dashed #c9ced3;
  border-radius: 12px;
  color: var(--muted);
  background: #fafafa;
}

.dropzone:hover,
.dropzone.dragging {
  border-color: var(--orange);
  color: var(--orange-dark);
  background: var(--orange-soft);
}

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

.dropzone span:last-child {
  font-size: 11px;
}

.upload-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid #e0e2e5;
  border-radius: 11px;
  color: var(--orange);
  background: white;
  font-size: 23px;
}

.image-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.image-preview {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fafafa;
}

.image-preview img {
  display: block;
  width: 100%;
  height: 82px;
  object-fit: cover;
}

.image-preview span {
  display: block;
  overflow: hidden;
  padding: 6px 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
}

.image-preview button {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: white;
  background: rgba(20, 25, 30, 0.75);
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 42px;
  padding: 0 17px;
  border-radius: 9px;
  font-weight: 700;
}

.primary-button {
  border: 1px solid var(--orange);
  color: white;
  background: var(--orange);
}

.primary-button:hover {
  border-color: var(--orange-dark);
  background: var(--orange-dark);
}

.primary-button:disabled {
  cursor: not-allowed;
  border-color: #d7dadd;
  background: #c7cbd0;
}

#generate-button {
  display: flex;
  width: 100%;
  justify-content: space-between;
  margin-top: 20px;
  padding: 0 18px;
}

.secondary-button {
  border: 1px solid #d5d9dd;
  color: #39424c;
  background: white;
}

.secondary-button:hover {
  border-color: #9ea5ad;
}

.danger-button {
  border: 1px solid #f1c2bf;
  color: var(--danger);
  background: #fff3f2;
}

.compact {
  min-height: 42px;
}

.form-message {
  min-height: 16px;
  margin: 8px 0 0;
  color: var(--danger);
}

.result-card {
  position: sticky;
  top: 96px;
}

.empty-state,
.loading-state {
  display: flex;
  min-height: 480px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}

.empty-state strong,
.loading-state strong {
  margin-top: 17px;
  font-size: 15px;
}

.empty-state p,
.loading-state p {
  max-width: 360px;
  margin: 7px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.business-feedback {
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid rgba(237, 97, 3, 0.28);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(237, 97, 3, 0.09), rgba(255, 255, 255, 0.94) 58%),
    var(--surface);
  box-shadow: 0 16px 40px rgba(91, 54, 28, 0.08);
}

.business-feedback-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.business-feedback-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}

.business-feedback-title {
  display: grid;
  gap: 2px;
}

.business-feedback-title small {
  color: var(--orange-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.business-feedback-title strong {
  color: var(--ink);
  font-size: 20px;
}

.business-feedback-summary {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.7;
}

.business-feedback-action {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  line-height: 1.6;
}

.business-feedback-action strong {
  color: var(--orange-dark);
  font-size: 13px;
}

.business-feedback-context {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.business-feedback-code {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  opacity: 0.76;
}

.empty-graphic {
  display: flex;
  width: 124px;
  height: 91px;
  align-items: end;
  justify-content: center;
  gap: 7px;
  padding: 18px;
  border-radius: 17px;
  transform: rotate(-2deg);
  background: linear-gradient(145deg, #fff3eb, #ffe1cc);
}

.empty-graphic span {
  width: 18px;
  border-radius: 5px 5px 2px 2px;
  background: var(--orange);
}

.empty-graphic span:nth-child(1) {
  height: 24px;
  opacity: 0.45;
}

.empty-graphic span:nth-child(2) {
  height: 50px;
}

.empty-graphic span:nth-child(3) {
  height: 36px;
  opacity: 0.68;
}

.loader {
  width: 45px;
  height: 45px;
  border: 3px solid #ffe0cb;
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.notice {
  margin-bottom: 13px;
  padding: 10px 12px;
  border-left: 3px solid var(--warning);
  border-radius: 7px;
  color: #6d4608;
  background: #fff7e8;
  font-size: 12px;
  line-height: 1.6;
}

.item-group {
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.item-heading {
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fafafa;
}

.item-heading strong {
  font-size: 13px;
}

.item-heading small {
  margin-left: 8px;
  color: var(--muted);
}

.link-button {
  border: 0;
  color: var(--orange-dark);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}

.defect-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 15px 14px;
  border-bottom: 1px solid var(--line);
}

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

.defect-category {
  display: inline-flex;
  margin-bottom: 7px;
  padding: 3px 7px;
  border-radius: 5px;
  color: var(--orange-dark);
  background: var(--orange-soft);
  font-size: 10px;
  font-weight: 700;
}

.defect-description {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.55;
}

.severity-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.severity-chip {
  padding: 4px 7px;
  border: 1px solid #e0e3e6;
  border-radius: 6px;
  color: #515a64;
  background: #fafafa;
  font-size: 10px;
}

.severity-chip b {
  margin-left: 3px;
  color: var(--ink);
}

.severity-chip.pending {
  border-color: #efd39d;
  color: var(--warning);
  background: #fff8e9;
}

.uncertain-flag {
  display: inline-block;
  margin-top: 8px;
  color: var(--warning);
  font-size: 10px;
}

.defect-actions {
  align-self: start;
  gap: 5px;
}

.icon-button {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #59616a;
  background: white;
}

.icon-button:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.icon-button.accept.selected {
  border-color: #a6dcc8;
  color: var(--success);
  background: #ecf9f4;
}

.icon-button.reject.selected {
  border-color: #efb9b6;
  color: var(--danger);
  background: #fff1f0;
}

.data-view {
  min-height: 70vh;
}

.page-heading {
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-heading h1 {
  font-size: 32px;
}

.page-actions {
  gap: 8px;
}

.filter-card {
  display: grid;
  grid-template-columns: 1.6fr 1fr 0.8fr 0.8fr 0.8fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  padding: 17px;
}

.filter-card label {
  color: var(--muted);
  font-size: 11px;
}

.filter-card input,
.filter-card select {
  margin-top: 6px;
}

.data-card {
  min-height: 320px;
  overflow: hidden;
}

.data-empty {
  display: grid;
  min-height: 320px;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  background: #fafafa;
  font-size: 10px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.decision {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
}

.decision.accept {
  color: var(--success);
  background: #eaf7f2;
}

.decision.reject {
  color: var(--danger);
  background: #fff0ef;
}

.dialog {
  width: min(510px, calc(100% - 30px));
  padding: 0;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 26px 80px rgba(20, 26, 32, 0.24);
}

.dialog::backdrop {
  background: rgba(16, 21, 27, 0.52);
  backdrop-filter: blur(3px);
}

.dialog form {
  padding: 25px;
}

.dialog h2 {
  margin: 8px 0;
  font-size: 20px;
}

.dialog p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.dialog textarea {
  min-height: 130px;
}

.dialog.small {
  width: min(410px, calc(100% - 30px));
}

.dialog-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  color: var(--danger);
  background: #fff0ef;
  font-size: 23px;
}

.dialog-actions {
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.toast-region {
  position: fixed;
  z-index: 50;
  right: 22px;
  bottom: 22px;
  display: flex;
  align-items: end;
  flex-direction: column;
  gap: 8px;
}

.toast {
  max-width: 360px;
  padding: 11px 14px;
  border: 1px solid #dfe2e5;
  border-radius: 9px;
  color: white;
  background: #26313c;
  box-shadow: 0 8px 30px rgba(20, 26, 32, 0.22);
  font-size: 12px;
}

.toast.error {
  background: var(--danger);
}

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

  .result-card {
    position: static;
  }

  .filter-card {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 11px 16px;
  }

  .brand img {
    width: 114px;
  }

  .brand-divider {
    margin: 0 12px;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .nav-button {
    padding: 8px 5px;
    font-size: 11px;
  }

  main {
    width: calc(100% - 24px);
    padding-top: 24px;
  }

  .hero {
    align-items: start;
    flex-direction: column;
    gap: 14px;
  }

  .hero h1 {
    font-size: 29px;
  }

  .workspace-grid {
    display: block;
  }

  .card {
    min-height: 0;
    margin-bottom: 14px;
    padding: 18px;
    border-radius: 13px;
  }

  .empty-state,
  .loading-state {
    min-height: 330px;
  }

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

  .filter-card {
    grid-template-columns: 1fr;
  }

  .page-heading {
    align-items: start;
    flex-direction: column;
    gap: 12px;
  }

  .page-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .data-card {
    overflow-x: auto;
  }

  .data-table {
    min-width: 750px;
  }
}
