:root {
  color-scheme: light;
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  background: #edf3f1;
  color: #102d32;
  font-synthesis: none;
  --ink: #102d32;
  --muted: #5c7275;
  --line: #c8d7d4;
  --surface: #ffffff;
  --soft: #f4f8f7;
  --teal: #087f72;
  --teal-dark: #075f57;
  --gold: #d5a227;
  --danger: #b33f34;
  --danger-soft: #fff4f2;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #edf3f1;
}

button,
input,
select {
  font: inherit;
}

button,
label[for] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.file-dropzone:focus-within {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  width: 100%;
  background: var(--surface);
  border-bottom: 3px solid var(--gold);
}

.topbar-inner {
  width: min(1180px, calc(100% - 40px));
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand-logo {
  display: block;
  width: min(300px, 68vw);
  height: 56px;
  object-fit: contain;
  object-position: left center;
}

.service-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.environment-badge {
  padding: 4px 8px;
  border: 1px solid #d7b85f;
  border-radius: 4px;
  background: #fff9e9;
  color: #75570b;
  font-size: 12px;
  font-weight: 800;
}

.service-name {
  color: #426065;
  font-size: 15px;
  font-weight: 700;
}

.main-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

.page-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  align-items: end;
  gap: 28px;
  padding-bottom: 24px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-size: 32px;
  line-height: 1.25;
  letter-spacing: 0;
}

.lead {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.connection-row {
  min-height: 68px;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.connection-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
}

.connection-dot[data-state="ready"] {
  background: var(--teal);
}

.connection-dot[data-state="waiting"] {
  background: var(--danger);
}

.connection-row strong {
  display: block;
  margin-bottom: 2px;
  font-size: 14px;
}

.connection-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.quote-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.8fr);
  align-items: start;
  gap: 18px;
}

.workspace-panel,
.settings-panel,
.job-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.workspace-panel,
.settings-panel {
  min-height: 510px;
  padding: 20px;
}

.settings-panel {
  position: sticky;
  top: 16px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading.compact {
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: 0;
}

.section-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.file-dropzone {
  min-height: 154px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 24px;
  border: 2px dashed #9dbbb5;
  border-radius: 6px;
  background: var(--soft);
  color: var(--ink);
  text-align: center;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.file-dropzone:hover,
.file-dropzone[data-dragging="true"] {
  border-color: var(--teal);
  background: #e8f5f2;
}

.file-dropzone:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.62;
}

.dropzone-symbol {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--teal);
  color: #ffffff;
  font-size: 24px;
  line-height: 1;
}

.file-dropzone strong {
  font-size: 16px;
}

.file-dropzone > span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.inline-notice {
  min-height: 20px;
  margin: 10px 0 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.inline-notice[data-state="error"] {
  color: var(--danger);
}

.inline-notice[data-state="success"] {
  color: var(--teal-dark);
}

.file-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.empty-state {
  margin: 30px 0;
  color: #809194;
  text-align: center;
  font-size: 14px;
}

.file-row {
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px 36px;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 12px;
  border: 1px solid #d4dfdd;
  border-radius: 5px;
  background: #fbfdfc;
}

.file-info {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.file-info strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-info span {
  color: var(--muted);
  font-size: 12px;
}

.quantity-field {
  display: grid;
  grid-template-columns: auto 56px;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.quantity-field input {
  width: 56px;
  min-height: 36px;
  padding: 0 7px;
  border: 1px solid #afc3bf;
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
}

.remove-button,
.icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid #afc3bf;
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.remove-button {
  border-color: #e1b8b2;
  color: var(--danger);
}

.remove-button:hover,
.icon-button:hover {
  background: #edf5f3;
}

.remove-button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

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

.field {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.field > span {
  color: #405a5e;
  font-size: 12px;
  font-weight: 700;
}

.field select {
  width: 100%;
  min-height: 40px;
  padding: 0 34px 0 10px;
  border: 1px solid #afc3bf;
  border-radius: 4px;
  background-color: var(--surface);
  color: var(--ink);
}

.field select:disabled {
  background: #edf2f1;
  color: #748588;
}

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

.verification-section {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #d7e1df;
}

.verification-section h3 {
  margin: 0;
  font-size: 15px;
}

.verification-section p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.verification-section p[data-state="ready"] {
  color: var(--teal-dark);
}

.verification-section p[data-state="error"] {
  color: var(--danger);
}

.turnstile-widget {
  min-height: 65px;
  overflow: hidden;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 5px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  width: 100%;
  margin-top: 18px;
  border: 1px solid var(--teal);
  background: var(--teal);
  color: #ffffff;
}

.primary-button:hover:not(:disabled) {
  background: var(--teal-dark);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.secondary-button {
  border: 1px solid var(--teal);
  background: var(--surface);
  color: var(--teal-dark);
}

.job-panel {
  margin-top: 18px;
  padding: 20px;
}

.job-panel[data-state="error"],
.job-panel[data-state="manual-review"] {
  border-color: #dda49b;
}

.job-status-row {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.job-status-row strong {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
}

.job-status-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

#job-progress-label {
  min-width: 48px;
  color: var(--teal-dark);
  font-weight: 800;
  text-align: right;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: #dce7e5;
}

.progress-track > span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--teal);
  transition: width 220ms ease;
}

.job-panel[data-state="error"] .progress-track > span,
.job-panel[data-state="manual-review"] .progress-track > span {
  background: var(--danger);
}

.quote-result {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 18px 0 0;
  border-top: 1px solid #d7e1df;
  border-left: 1px solid #d7e1df;
}

.quote-result > div {
  min-width: 0;
  padding: 14px;
  border-right: 1px solid #d7e1df;
  border-bottom: 1px solid #d7e1df;
}

.quote-result dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.quote-result dd {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.job-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.footer {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-top: 1px solid #cfdbd9;
  color: #52696d;
  font-size: 13px;
}

@media (max-width: 900px) {
  .page-heading,
  .quote-layout {
    grid-template-columns: 1fr;
  }

  .settings-panel {
    position: static;
    min-height: auto;
  }

  .page-heading {
    align-items: start;
  }
}

@media (max-width: 640px) {
  .topbar-inner,
  .main-shell {
    width: min(100% - 24px, 1180px);
  }

  .topbar-inner {
    min-height: 66px;
  }

  .brand-logo {
    height: 48px;
  }

  .service-name {
    display: none;
  }

  .main-shell {
    padding: 24px 0 34px;
  }

  .page-heading {
    gap: 18px;
    padding-bottom: 18px;
  }

  h1 {
    font-size: 28px;
  }

  .lead {
    font-size: 14px;
  }

  .workspace-panel,
  .settings-panel,
  .job-panel {
    padding: 16px;
  }

  .workspace-panel {
    min-height: 430px;
  }

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

  .field-wide {
    grid-column: auto;
  }

  .file-row {
    grid-template-columns: minmax(0, 1fr) 36px;
  }

  .quantity-field {
    grid-column: 1 / 2;
    justify-content: start;
  }

  .remove-button {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .quote-result {
    grid-template-columns: 1fr;
  }

  .turnstile-widget {
    max-width: 100%;
    overflow-x: auto;
  }
}
