:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #66717a;
  --line: #d9e1e6;
  --panel: #ffffff;
  --soft: #f4f7f6;
  --accent: #0f8b8d;
  --accent-strong: #0a6268;
  --warm: #f0b15a;
  --success: #2f8f5b;
  --shadow: 0 18px 45px rgba(30, 42, 48, 0.12);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 139, 141, 0.08), rgba(240, 177, 90, 0.12)),
    var(--soft);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  min-height: calc(100vh - 48px);
  margin: 24px auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 18px;
  align-items: start;
}

.workspace,
.settings {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(217, 225, 230, 0.9);
  box-shadow: var(--shadow);
}

.workspace {
  padding: clamp(18px, 3vw, 34px);
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 16px;
  align-content: start;
}

.intro {
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(26px, 3vw, 40px);
  line-height: 1.06;
  letter-spacing: 0;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 56px;
  padding-bottom: 2px;
}

.intro-copy,
.drop-copy p,
.note,
.field-hint {
  color: var(--muted);
  line-height: 1.7;
}

.site-logo {
  width: 174px;
  height: 54px;
  object-fit: contain;
  object-position: left center;
  mix-blend-mode: multiply;
}

.site-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.site-header-actions p {
  margin: 0 8px 0 0;
}

.header-button {
  min-height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent-strong);
  padding: 0 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.header-button:hover {
  border-color: var(--accent);
}

.header-button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.header-button.primary:hover {
  background: var(--accent-strong);
}

.drop-panel {
  position: relative;
  min-height: 118px;
  border: 2px dashed #aab9bf;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 247, 246, 0.92)),
    repeating-linear-gradient(90deg, transparent 0 34px, rgba(15, 139, 141, 0.06) 34px 35px);
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: clamp(16px, 2.5vw, 24px);
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.drop-panel.dragging {
  border-color: var(--accent);
  transform: translateY(-2px);
  background:
    linear-gradient(180deg, rgba(232, 250, 247, 0.95), rgba(255, 249, 240, 0.95)),
    repeating-linear-gradient(90deg, transparent 0 34px, rgba(15, 139, 141, 0.08) 34px 35px);
}

#fileInput {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.printer-visual {
  position: relative;
  height: 230px;
  border: 6px solid #25333a;
  border-bottom-width: 16px;
  background: linear-gradient(180deg, #eef6f5 0%, #dfe9e8 100%);
  overflow: hidden;
}

.printer-visual::before,
.printer-visual::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 18px;
  height: 100%;
  background: #25333a;
}

.printer-visual::before {
  left: 26px;
}

.printer-visual::after {
  right: 26px;
}

.gantry {
  position: absolute;
  left: 28px;
  right: 28px;
  top: 58px;
  height: 12px;
  background: #25333a;
}

.toolhead {
  position: absolute;
  top: 36px;
  left: 50%;
  width: 54px;
  height: 54px;
  transform: translateX(-50%);
  background: var(--accent);
  box-shadow: inset 0 -10px 0 rgba(0, 0, 0, 0.16);
}

.toolhead::after {
  content: "";
  position: absolute;
  left: 20px;
  bottom: -18px;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 20px solid #25333a;
}

.print-bed {
  position: absolute;
  left: 54px;
  right: 54px;
  bottom: 34px;
  height: 22px;
  background: #3c4b52;
}

.print-object {
  position: absolute;
  left: 50%;
  bottom: 22px;
  width: 112px;
  height: 68px;
  transform: translateX(-50%);
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.2) 0 2px, transparent 2px 8px),
    var(--warm);
  clip-path: polygon(18% 100%, 18% 38%, 38% 38%, 38% 8%, 62% 8%, 62% 38%, 82% 38%, 82% 100%);
}

.drop-copy h2 {
  margin-bottom: 6px;
  font-size: clamp(20px, 2.4vw, 26px);
}

.drop-copy p {
  margin-bottom: 0;
  font-size: 13px;
}

.drop-copy .field-hint {
  margin-top: 5px;
}

.primary-button {
  width: max-content;
  min-height: 44px;
  border: 0;
  background: var(--accent);
  color: white;
  padding: 0 22px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  width: max-content;
  min-height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent-strong);
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
}

.secondary-button:hover {
  border-color: var(--accent);
}

.product-files {
  border: 1px solid var(--line);
  background: #fff;
  padding: 14px;
}

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

.product-files-header h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.product-files-header .eyebrow {
  margin-bottom: 6px;
}

.product-files-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.product-files-list > p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.product-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  background: #f8faf9;
  padding: 10px 12px;
}

.product-file-item strong,
.product-file-item span {
  display: block;
}

.product-file-item strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.product-file-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.product-files .secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  align-items: stretch;
}

.metric {
  min-height: 76px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
  display: grid;
  align-content: space-between;
}

.metric span,
.breakdown span {
  color: var(--muted);
  font-size: 14px;
}

.metric small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.metric strong {
  font-size: clamp(17px, 2vw, 24px);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.metric.total {
  background: #172026;
  color: white;
  border-color: #172026;
}

.metric.total span {
  color: rgba(255, 255, 255, 0.76);
}

.metric.profit {
  border-color: rgba(15, 139, 141, 0.28);
  background: #f7fbfa;
}

.settings {
  padding: 28px;
  overflow: auto;
}

.settings-header h2 {
  margin-bottom: 0;
  font-size: 28px;
}

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

.profile-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 220px;
}

.profile-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent-strong);
  padding: 0 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.profile-actions button:hover {
  border-color: var(--accent);
}

.profile-actions span {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: right;
}

.profile-status {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.compact-grid {
  margin-top: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #35434b;
  font-size: 13px;
  font-weight: 700;
}

.field-hint {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 0 11px;
  outline: none;
}

.input-with-suffix {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  border: 1px solid var(--line);
  background: #fff;
}

.input-with-suffix:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 139, 141, 0.16);
}

.input-with-suffix input {
  border: 0;
  box-shadow: none;
}

.input-with-suffix input:focus {
  box-shadow: none;
}

.input-with-suffix span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 139, 141, 0.16);
}

.inline-link {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.inline-link:hover {
  text-decoration: underline;
}

.other-cost-settings {
  margin-top: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  padding: 14px 16px;
}

.other-cost-settings summary {
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.breakdown {
  margin-top: 24px;
  border: 1px solid var(--line);
  background: #fff;
}

.breakdown div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}

.breakdown div:last-child {
  border-bottom: 0;
}

.breakdown strong {
  font-size: 18px;
}

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

.feedback-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(23, 32, 38, 0.42);
  padding: 20px;
}

.feedback-modal.visible {
  display: flex;
}

.feedback-card {
  position: relative;
  width: min(520px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 24px;
}

.feedback-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.feedback-card h2 {
  margin-bottom: 8px;
  font-size: 24px;
}

.feedback-copy {
  color: var(--muted);
  line-height: 1.6;
}

.feedback-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.feedback-qr {
  display: block;
  width: min(320px, 100%);
  margin: 18px auto;
  border: 1px solid var(--line);
  background: #fff;
}

.social-card {
  width: min(760px, 100%);
}

.social-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

.social-grid article {
  border: 1px solid var(--line);
  background: #f8faf9;
  padding: 12px;
}

.social-grid strong,
.social-grid span {
  display: block;
}

.social-grid strong {
  color: var(--ink);
  font-size: 16px;
}

.social-grid span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.social-grid img {
  display: block;
  width: 100%;
  max-height: 420px;
  margin-top: 12px;
  border: 1px solid var(--line);
  background: #fff;
  object-fit: contain;
}

.primary-link-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
  text-decoration: none;
  font-weight: 800;
}

.primary-link-button:hover {
  background: var(--accent-strong);
}

.quote-builder {
  border: 1px solid var(--line);
  background: #fff;
  padding: 18px;
}

.quote-header,
.quote-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quote-header {
  margin-bottom: 14px;
}

.quote-header h2 {
  margin-bottom: 0;
  font-size: 22px;
}

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

.quote-actions {
  justify-content: flex-start;
  margin: 14px 0;
}

.quote-status {
  display: none;
  margin: -4px 0 14px;
  border: 1px solid rgba(15, 139, 141, 0.24);
  background: #f0faf8;
  color: var(--accent-strong);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.quote-status.visible {
  display: block;
}

.quote-preview {
  background: #f5f7f7;
  border: 1px solid var(--line);
  padding: 14px;
}

.quote-document {
  background: #fff;
  border: 1px solid #e1e7eb;
  padding: 28px;
}

.quote-doc-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 2px solid #172026;
  padding-bottom: 18px;
}

.quote-label {
  margin-bottom: 6px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

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

#quoteLogoPreview {
  display: none;
  width: 72px;
  height: 72px;
  object-fit: contain;
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px;
}

#quoteLogoPreview.visible {
  display: block;
}

.quote-doc-header h2 {
  margin-bottom: 6px;
  font-size: 30px;
}

.quote-doc-header p,
.quote-party-grid p,
.quote-meta span {
  color: var(--muted);
}

.quote-meta {
  min-width: 150px;
  text-align: right;
}

.quote-meta strong {
  display: block;
  margin: 5px 0 12px;
  font-size: 18px;
}

.quote-party-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.quote-party-grid > div {
  background: #f8faf9;
  border: 1px solid var(--line);
  padding: 14px;
}

.quote-party-grid h3 {
  margin: 0 0 8px;
  color: #35434b;
  font-size: 14px;
}

.quote-party-grid p {
  margin: 4px 0 0;
  font-size: 13px;
}

.quote-table {
  width: 100%;
  margin-top: 18px;
  border-collapse: collapse;
}

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

.quote-table th {
  color: #35434b;
  font-size: 13px;
}

.quote-table td:last-child,
.quote-table th:last-child {
  text-align: right;
}

.text-button {
  display: block;
  margin-left: auto;
  margin-top: 5px;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.quote-footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  padding-top: 18px;
}

.print-quote-button {
  min-height: 48px;
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 0 24px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 900;
}

.print-quote-button:hover {
  background: var(--accent-strong);
}

.quote-total {
  display: flex;
  align-items: baseline;
  gap: 18px;
}

.quote-summary {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.quote-extra-line {
  display: none;
  align-items: baseline;
  gap: 16px;
  color: var(--muted);
  font-weight: 800;
}

.quote-extra-line.visible {
  display: flex;
}

.quote-extra-line strong {
  color: var(--ink);
  font-size: 18px;
}

.quote-total span {
  color: var(--muted);
  font-weight: 800;
}

.quote-total strong {
  font-size: 28px;
}

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

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

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

@media (max-width: 680px) {
  .app-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
  }

  .workspace,
  .settings {
    border-left: 0;
    border-right: 0;
    box-shadow: none;
  }

  .drop-panel,
  .results,
  .field-grid,
  .quote-controls,
  .quote-party-grid {
    grid-template-columns: 1fr;
  }

  .product-files-header,
  .product-file-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .printer-visual {
    height: 190px;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .site-logo {
    width: 158px;
    height: 48px;
  }

  .site-header-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .site-header-actions p {
    flex-basis: 100%;
    margin-right: 0;
  }

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

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

  html,
  body {
    background: #fff;
    min-height: 0;
  }

  .app-shell {
    display: block;
    width: auto;
    min-height: 0;
    margin: 0;
  }

  .workspace {
    display: block;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: #fff;
  }

  .settings,
  .intro,
  .drop-panel,
  .results,
  .quote-header,
  .quote-controls,
  .quote-actions,
  .quote-status,
  .feedback-button,
  .feedback-modal {
    display: none;
  }

  .quote-builder {
    border: 0;
    padding: 0;
    background: #fff;
  }

  .quote-preview {
    border: 0;
    padding: 0;
    background: #fff;
  }

  .quote-document {
    border: 0;
    padding: 0;
    break-inside: avoid;
  }

  .quote-doc-header,
  .quote-party-grid,
  .quote-table,
  .quote-footer {
    break-inside: avoid;
  }

  .text-button,
  .print-quote-button {
    display: none;
  }
}

.directory-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 24px auto;
}

.directory-header {
  padding: clamp(24px, 5vw, 52px);
  background: #172026;
  color: #fff;
}

.directory-header .eyebrow,
.directory-header .intro-copy {
  color: rgba(255, 255, 255, 0.74);
}

.directory-header h1 {
  max-width: 760px;
}

.directory-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.directory-actions a,
.back-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  padding: 0 16px;
  text-decoration: none;
  font-weight: 800;
}

.directory-actions a:first-child {
  background: var(--accent);
  border-color: var(--accent);
}

.directory-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.directory-card {
  background: #fff;
  border: 1px solid var(--line);
  padding: 20px;
}

.directory-card h2 {
  margin-bottom: 10px;
  font-size: 20px;
}

.directory-card p {
  color: var(--muted);
  line-height: 1.7;
}

.city-list {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  color: #35434b;
  line-height: 1.8;
}

.directory-card a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.directory-card a:hover {
  text-decoration: underline;
}
