:root {
  --sidebar-w: 200px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
}
.hidden { display: none !important; }
a.link { color: var(--link); }

/* login */
.login-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.login-screen-inner {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.site-footer {
  padding: 12px 16px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.site-footer a {
  color: inherit;
  text-decoration: none;
}
.site-footer a:hover {
  text-decoration: underline;
}
.login-card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 28px 24px;
}
.login-brand {
  text-align: center;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  line-height: 0;
}
.brand-logo {
  height: 28px;
  width: auto;
  max-width: 140px;
  display: block;
}
.brand-logo-lg {
  height: 36px;
  margin: 0 auto;
  max-width: 180px;
}
.login-sub {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 12px 0 20px;
}
.login-card label {
  display: block;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--muted);
}
.login-card input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  font-size: 14px;
  background: var(--surface);
}
.login-error { color: var(--brand); font-size: 12px; min-height: 18px; text-align: center; }

/* buttons */
.btn-primary {
  width: 100%;
  border: none;
  background: var(--brand);
  color: #fff;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}
.btn-ghost:hover { background: var(--surface-muted); }
.btn-ghost.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-danger {
  border: none;
  background: none;
  color: var(--link);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  font-family: inherit;
  text-decoration: underline;
}
.btn-xs { padding: 4px 8px; font-size: 12px; }

/* app shell */
.app-root { min-height: 100vh; }
.app-root.layout-sidebar {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}
.app-root.layout-sidebar.has-products {
  grid-template-columns: var(--sidebar-w) 1fr 260px;
}

.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.sidebar-brand {
  padding: 12px 16px 14px;
  border-bottom: 1px solid var(--line);
  line-height: 0;
}
.sidebar-role {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
}
.sidebar-nav { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; }
.nav-btn {
  border: none;
  background: none;
  text-align: left;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--line-subtle);
  font-family: inherit;
}
.nav-btn:hover { background: var(--surface-muted); }
.nav-btn.active { background: var(--brand); color: #fff; }
.sidebar-foot {
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  font-size: 12px;
  color: var(--muted);
  margin-top: auto;
}

.main-area {
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
}
.topbar {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  flex-shrink: 0;
}
.topbar--quote {
  padding: 14px 20px;
  min-height: 84px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  border-bottom: 2px solid #d8d8d8;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}
.topbar-left--quote {
  gap: 20px;
  align-items: stretch;
}
.quote-mode-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  flex: 1;
  max-width: 1080px;
}
.quote-mode-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 2px solid #d0d0d0;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s, transform 0.12s;
}
.quote-mode-card:hover {
  border-color: #888;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.quote-mode-card.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 16px rgba(var(--brand-rgb), 0.28);
  transform: translateY(-1px);
}
.quote-mode-card__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface-muted);
}
.quote-mode-card.active .quote-mode-card__icon {
  background: rgba(255, 255, 255, 0.14);
}
.quote-mode-card.active .quote-mode-icon {
  filter: brightness(0) invert(1);
}
.quote-mode-card__body {
  min-width: 0;
}
.quote-mode-card__title {
  display: block;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.02em;
}
.quote-mode-card__desc {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.35;
}
.quote-mode-card.active .quote-mode-card__desc {
  color: rgba(255, 255, 255, 0.78);
}
.quote-mode-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  flex-shrink: 0;
  align-self: center;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: nowrap;
}
.topbar-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: #f0f0f0;
  border-radius: 8px;
  flex-shrink: 0;
}
.topbar-tab {
  border: none;
  background: transparent;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.2;
}
.topbar-tab:hover { color: var(--text); }
.topbar-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.topbar-title { font-weight: 700; font-size: 14px; margin: 0; }
.topbar-hint { font-size: 12px; color: var(--link); white-space: nowrap; }
@media (max-width: 1100px) {
  .topbar-left--quote {
    flex-direction: column;
    align-items: stretch;
  }
  .quote-mode-switch {
    max-width: none;
  }
  .quote-mode-hint {
    align-self: flex-start;
    white-space: normal;
  }
}
@media (max-width: 720px) {
  .quote-mode-switch {
    grid-template-columns: 1fr;
  }
  .quote-mode-card__title {
    font-size: 15px;
  }
}
.main-content.system-quote-view {
  overflow: hidden;
  padding: 0;
}
.system-quote-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.system-quote-body {
  flex: 1;
  padding: 16px;
  max-width: 720px;
}
.yinshua-quote-wrap .system-quote-body {
  max-width: none;
  padding: 0;
  height: 100%;
  min-height: 0;
}
.yinshua-layout {
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  gap: 0;
  height: calc(100vh - 84px);
  min-height: 0;
  overflow: hidden;
}
.yinshua-layout-embed {
  min-height: calc(100vh - 88px);
}
.yinshua-embed-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.yinshua-embed-note {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}
.yinshua-embed-frame-wrap {
  flex: 1;
  min-height: 0;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.yinshua-embed-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 150px);
  min-height: 640px;
  border: 0;
  background: var(--surface);
}
.yinshua-menu {
  border-right: 1px solid var(--line);
  padding: 8px 6px;
  overflow: auto;
  background: var(--bg);
  min-height: 0;
}
.yinshua-menu-group { margin-bottom: 10px; }
.yinshua-menu-group-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px 6px;
}
.yinshua-menu-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  text-align: left;
  padding: 5px 7px;
  margin-bottom: 1px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  line-height: 1.35;
}
.yinshua-menu-thumb {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--line-subtle);
  padding: 1px;
  cursor: zoom-in;
}
.yinshua-menu-text {
  min-width: 0;
  flex: 1;
  line-height: 1.35;
}
.yinshua-menu-item.active .yinshua-menu-thumb {
  border-color: var(--brand-muted);
  background: var(--surface);
}

.yinshua-menu-preview {
  position: fixed;
  z-index: 1200;
  pointer-events: auto;
}
.yinshua-menu-preview.hidden {
  display: none;
}
.yinshua-menu-preview__card {
  width: 280px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.yinshua-menu-preview__img {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: contain;
  background: var(--bg);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-sm);
  cursor: zoom-in;
}
.yinshua-menu-preview__title {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}
.yinshua-menu-preview__hint {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}
.yinshua-menu-preview__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 10px;
}
.yinshua-menu-preview__upload {
  cursor: pointer;
}
.yinshua-menu-preview__msg {
  margin: 8px 0 0;
  font-size: 12px;
  text-align: center;
}

.yinshua-menu-item:hover { background: var(--surface-muted); }
.yinshua-menu-item.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 600;
}
.yinshua-menu-item--preview { opacity: 0.72; }
.yinshua-menu-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  font-size: 10px;
  line-height: 1.4;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--muted);
  vertical-align: middle;
}
.yinshua-menu-item.active .yinshua-menu-badge {
  background: rgba(var(--brand-rgb), 0.12);
  color: var(--brand);
}
.yinshua-support-notice {
  margin: 8px 0 0;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-md);
}
.yinshua-support-notice.hidden { display: none; }
.yinshua-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}
.yinshua-form-head {
  flex-shrink: 0;
  padding: 8px 14px 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.yinshua-form-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.yinshua-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}
.yinshua-form-col {
  overflow: auto;
  padding: 10px 12px 12px;
  min-height: 0;
}
.yinshua-price-col {
  border-left: 1px solid var(--line);
  background: var(--surface);
  padding: 12px;
  overflow: auto;
  min-height: 0;
}
.yinshua-quote-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.yinshua-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  align-items: start;
}
.yinshua-section-panel {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  border: 1px solid var(--line);
  background: var(--surface);
  min-height: 34px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.yinshua-section-panel--wide {
  grid-column: 1 / -1;
}
.yinshua-section-label {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--brand-soft);
  border-right: 1px solid var(--brand-muted);
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  padding: 6px 4px;
  line-height: 1.25;
  word-break: break-all;
}
.yinshua-section-body {
  min-width: 0;
}
.yinshua-section-body--inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 6px 10px;
}
.yinshua-section-body--fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px 10px;
  padding: 6px 10px;
}
.yinshua-section-body--dense {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 8px;
  padding: 6px 10px;
}
.yinshua-section-body--checks {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px 8px;
  padding: 6px 10px;
}
.yinshua-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.yinshua-field--inline,
.yinshua-section-body--inline .yinshua-field {
  flex-direction: row;
  align-items: center;
  gap: 4px;
}
.yinshua-field--check {
  flex-direction: row;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
}
.yinshua-field--check input {
  margin: 0;
  flex-shrink: 0;
}
.yinshua-field--foil-side {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 4px 0 2px;
}
.yinshua-foil-side-check {
  min-width: 4.5em;
}
.yinshua-foil-side-select {
  flex: 1 1 12rem;
  min-width: 10rem;
  max-width: 100%;
}
.yinshua-field--side-area {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 4px 0 2px;
}
.yinshua-side-area-check {
  min-width: 4.5em;
}
.yinshua-side-area-dims {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.yinshua-side-area-input {
  width: 3.25rem;
  min-width: 3.25rem;
}
.yinshua-side-area-x,
.yinshua-side-area-unit {
  font-size: 12px;
  color: var(--muted);
}
.yinshua-field--check .yinshua-field-label {
  margin: 0;
  font-weight: 400;
  color: var(--text);
}
.yinshua-field-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}
.yinshua-field-input,
.yinshua-field-select {
  width: 100%;
  min-width: 0;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--surface);
  height: 26px;
  line-height: 1.2;
}
.yinshua-field--short .yinshua-field-input {
  width: 64px;
  flex-shrink: 0;
}
.yinshua-section-body--inline .yinshua-field--short .yinshua-field-input {
  width: 56px;
}
.yinshua-field--qty .yinshua-field-input {
  width: 7.5rem;
  min-width: 7.5rem;
  flex-shrink: 0;
}
.yinshua-section-body--inline .yinshua-field--qty .yinshua-field-input {
  width: 6.5rem;
  min-width: 6.5rem;
}
.yinshua-field--select {
  flex: 1 1 140px;
  min-width: 120px;
}
.yinshua-field-input:focus,
.yinshua-field-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 1px rgba(var(--brand-rgb), 0.22);
}
.yinshua-form-actions {
  padding-top: 4px;
}
.yinshua-calc-btn {
  width: 120px;
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.04em;
}
.yinshua-calc-btn:hover:not(:disabled) { background: var(--brand-hover); }
.yinshua-calc-btn:disabled {
  background: var(--muted);
  cursor: not-allowed;
}
.yinshua-price-empty {
  text-align: center;
  padding: 24px 12px;
  color: var(--muted);
}
.yinshua-price-empty__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.yinshua-price-empty__hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
}
.yinshua-price-card {
  min-height: 100%;
}
.yinshua-price-card__head {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--brand);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.yinshua-engine-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}
.yinshua-result-head {
  margin: 8px 0 10px;
}
.yinshua-result-price {
  font-size: 36px;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.05;
}
.yinshua-unit { font-size: 15px; font-weight: 600; margin-left: 2px; }
.yinshua-unit-price { font-size: 12px; color: var(--muted); margin-top: 4px; }
.yinshua-group-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}
.yinshua-group-tab {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  font-size: 11px;
  cursor: pointer;
  color: var(--text);
}
.yinshua-group-tab:hover { border-color: var(--brand); color: var(--brand); }
.yinshua-group-tab.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}
.yinshua-result-remark,
.yinshua-result-pay {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 4px;
  line-height: 1.45;
}
.yinshua-summary {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.45;
  background: var(--brand-soft);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin: 8px 0 0;
  border: 1px solid var(--brand-muted);
  color: var(--text);
  max-height: 280px;
  overflow: auto;
}
.yinshua-field-select { appearance: auto; }
@media (max-width: 1280px) {
  .yinshua-sections { grid-template-columns: 1fr; }
  .yinshua-section-body--checks { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .yinshua-section-body--dense { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .yinshua-workspace { grid-template-columns: 1fr; }
  .yinshua-price-col {
    border-left: none;
    border-top: 1px solid #c5c5c5;
    max-height: 220px;
  }
}
@media (max-width: 760px) {
  .yinshua-layout { grid-template-columns: 1fr; height: auto; }
  .yinshua-menu {
    max-height: 140px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .yinshua-section-body--checks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.system-quote-form { display: flex; flex-direction: column; gap: 12px; }
.system-quote-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.system-field { display: flex; flex-direction: column; gap: 4px; }
.system-field-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.system-field-input {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
}
.system-field-input:focus {
  outline: none;
  border-color: var(--brand);
}
.system-quote-actions { padding-top: 4px; }
.system-quote-result {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.system-quote-result.hidden { display: none; }
.system-quote-tip { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.system-quote-error { color: var(--brand); }
.main-content { flex: 1; overflow: auto; display: flex; flex-direction: column; min-height: 0; }
.main-content.padded { padding: 16px; }
.main-content.chat-view {
  overflow: hidden;
  padding: 0;
}

.meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 6px 16px;
  font-size: 11px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
  flex-shrink: 0;
}
.meta-bar span::before { content: "· "; color: #999; }
.meta-bar span:first-child::before { content: ""; }

/* chat */
.cs-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  min-height: 0;
}
.cs-chat-wrap {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 16px;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.chat-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.chat-who {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  padding-top: 2px;
}
.chat-row.user .chat-who { color: var(--brand); font-weight: 600; }
.chat-content {
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}
.chat-input-bar {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
  flex-shrink: 0;
}
.chat-input-bar textarea {
  flex: 1;
  min-width: 0;
  border: none;
  border-left: 1px solid var(--line);
  padding: 14px 16px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  min-height: 96px;
  max-height: 120px;
  overflow-y: auto;
  background: var(--surface);
}
.chat-input-bar .chat-image-btn {
  flex-shrink: 0;
  align-self: center;
  margin: 0 8px;
  font-size: 13px;
  line-height: 1;
  padding: 8px 10px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chat-image-icon { flex-shrink: 0; }
.chat-input-bar .btn-primary {
  flex-shrink: 0;
  border-left: 1px solid var(--line);
  width: 64px;
  min-width: 64px;
  padding: 0 8px;
  align-self: stretch;
  min-height: 96px;
}

.quote-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 13px;
}
.quote-table th,
.quote-table td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  text-align: left;
}
.quote-table th { background: var(--surface-muted); font-weight: 600; }
.quote-table .total td {
  font-weight: 700;
  background: var(--brand-soft);
  color: var(--brand);
}
.quote-summary {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.btn-sm {
  width: auto;
  padding: 6px 12px;
  font-size: 12px;
}
.btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-outline:hover { background: var(--surface-muted); }

.params-form {
  margin-top: 10px;
  padding: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
}
.params-form-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
}
.params-form-row { margin-bottom: 8px; }
.params-form-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.params-form-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
}

.quote-card {
  margin-top: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  max-width: 100%;
}
.quote-card-header {
  padding: 10px 14px;
  background: linear-gradient(90deg, var(--brand-soft), #fff);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.quote-summary-line {
  padding: 8px 14px 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.quote-badge {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
}
.quote-product { font-weight: 700; }
.quote-total {
  color: var(--brand);
  font-weight: 700;
  font-size: 18px;
  margin-left: auto;
}
.quote-assumptions {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.quote-assumptions-compact {
  padding-top: 6px;
}
.quote-assumptions-title { font-weight: 600; margin-bottom: 4px; }
.quote-assumption-item { margin-top: 2px; }
.quote-assumption-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.quote-assumption-chip {
  display: inline-block;
  max-width: 100%;
  padding: 2px 8px;
  background: var(--surface-muted);
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}
.quote-link-btn {
  margin-top: 6px;
  padding: 0;
  border: none;
  background: none;
  color: var(--brand);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.quote-link-btn:hover { text-decoration: underline; }
.quote-breakdown { padding: 8px 14px; }
.quote-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
}
.quote-breakdown-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  padding: 4px 0;
}
.quote-breakdown-item--total {
  grid-column: 1 / -1;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-weight: 700;
}
.quote-breakdown-key { color: var(--muted); }
.quote-breakdown-val { font-weight: 600; color: var(--text); }
.quote-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px dashed #eee;
}
.quote-detail {
  padding: 10px 14px;
  background: var(--surface-muted);
  max-height: 280px;
  overflow-y: auto;
}
.quote-detail pre {
  margin: 0;
  white-space: pre-wrap;
  font-size: 12px;
  font-family: inherit;
}
.quote-actions {
  padding: 10px 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.quote-actions-main {
  border-top: 1px solid var(--line);
}
.quote-actions-extra {
  padding-top: 0;
  border-top: none;
}
.quote-extra {
  padding: 0 14px 8px;
}
.quote-extra.is-open .quote-actions-extra {
  padding-top: 8px;
}
.quote-compare {
  border-top: 1px solid var(--line);
}
.quote-compare-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: none;
  background: var(--surface);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.quote-compare-toggle:hover { background: var(--surface-muted); }
.quote-compare .compare-chips {
  padding: 0 14px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.compare-bar {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--line);
}
.compare-label {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}
.compare-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.chip-btn:hover { background: var(--surface-muted); }

/* products sidebar */
.cs-products-wrap {
  border-left: 1px solid var(--line);
  background: var(--bg);
  overflow-y: auto;
  height: 100%;
  min-height: 0;
}
.products-head {
  margin: 0;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}
.product-card-mini {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.product-card-mini:hover { background: var(--brand-soft); }
.product-card-mini h4 {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--link);
  text-decoration: underline;
}
.product-card-mini p { margin: 0; font-size: 12px; color: var(--muted); }

/* panels & tables */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}
.panel-head {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 13px;
  background: var(--surface-muted);
}
.panel-body { padding: 16px; }

.product-intro-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.product-intro-title { flex-shrink: 0; }
.product-search {
  flex: 1;
  max-width: 400px;
  min-width: 200px;
}
.product-search-input {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--line);
  font-size: 13px;
  background: var(--surface);
  font-family: inherit;
}
.product-search-input:focus {
  outline: none;
  border-color: var(--brand);
}
.product-search-meta {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
}
.product-intro-body { padding-top: 12px; }

.product-intro-type-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.product-intro-type-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border: 2px solid #d0d0d0;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s, transform 0.12s;
}
.product-intro-type-card:hover {
  border-color: #888;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.product-intro-type-card.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 16px rgba(var(--brand-rgb), 0.28);
  transform: translateY(-1px);
}
.product-intro-type-card__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--surface-muted);
}
.product-intro-type-card.active .product-intro-type-card__icon {
  background: rgba(255, 255, 255, 0.14);
}
.product-intro-type-card.active .product-intro-type-icon {
  filter: brightness(0) invert(1);
}
.product-intro-type-card__body {
  flex: 1;
  min-width: 0;
}
.product-intro-type-card__title {
  display: block;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.02em;
}
.product-intro-type-card__desc {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.35;
}
.product-intro-type-card.active .product-intro-type-card__desc {
  color: rgba(255, 255, 255, 0.82);
}
.product-intro-type-card__count {
  flex-shrink: 0;
  min-width: 36px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  background: var(--surface-muted);
  color: var(--brand);
}
.product-intro-type-card.active .product-intro-type-card__count {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
@media (max-width: 900px) {
  .product-intro-type-cards {
    grid-template-columns: 1fr;
  }
  .product-intro-type-card__title {
    font-size: 16px;
  }
}

.product-fold-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.product-fold {
  border: 1px solid var(--line);
  margin-bottom: 8px;
  background: var(--surface);
}
.product-fold--l1 { margin-bottom: 10px; }
.product-fold--field {
  margin-bottom: 6px;
  margin-left: 0;
  border-color: #e8e8e8;
}
.product-fold--field .product-fold-summary--field {
  padding: 8px 12px;
  font-size: 13px;
  background: #fafafa;
}
.product-fold-body--field {
  padding: 10px 12px 12px;
  background: var(--surface);
}

.spec-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.spec-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  line-height: 1.35;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.spec-chip:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.spec-chip--has-img {
  padding-left: 6px;
  border-radius: 999px;
}
.spec-chip__img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-muted);
  cursor: zoom-in;
}
.spec-chip__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spec-chip-mark {
  padding: 0 1px;
  border-radius: 2px;
  background: rgba(var(--brand-rgb), 0.22);
  color: inherit;
  font-weight: 600;
}

.product-fold--mini { margin-bottom: 6px; font-size: 12px; }
.product-fold--manage { margin-bottom: 8px; }
.product-fold--crumb { margin-left: 0; }
.product-fold--l1 .product-fold--crumb {
  margin-left: 12px;
  margin-right: 8px;
}
.product-fold-body--l1 {
  padding: 8px 0 4px;
}
.product-fold-body {
  padding: 0 12px 12px;
}
.product-fold--mini .product-fold-body {
  padding: 0 8px 8px;
}
.product-fold--mini.product-fold--l1 .product-fold--crumb {
  margin-left: 8px;
}

.product-fold > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.product-fold > summary::-webkit-details-marker { display: none; }

.product-fold-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface-muted);
  font-size: 14px;
  line-height: 1.4;
}
.product-fold-summary--mini {
  padding: 7px 8px;
  font-size: 11px;
  gap: 6px;
}
.product-fold-summary--manage {
  padding: 8px 10px;
  font-size: 13px;
}
.product-fold-summary--l1 {
  font-weight: 700;
}
.product-fold-l1-title {
  flex: 1;
  min-width: 0;
}
.product-fold-summary-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.product-fold-chevron {
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid var(--muted);
  transition: transform 0.15s ease;
}
.product-fold[open] > summary .product-fold-chevron {
  transform: rotate(90deg);
}

.product-breadcrumb-sep {
  color: var(--muted);
  font-weight: 400;
  user-select: none;
}
.product-breadcrumb-part { color: var(--muted); }
.product-breadcrumb-part--current {
  color: var(--text);
  font-weight: 700;
}
.product-breadcrumb-count {
  flex-shrink: 0;
  margin-left: auto;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.product-category-block {
  margin-bottom: 20px;
}
.product-category-block:last-child { margin-bottom: 0; }
.product-category-block--mini { margin-bottom: 14px; }
.product-category-block--manage {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.product-category-block--manage:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.product-category-head {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.product-category-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
}
.product-category-empty {
  margin: 0;
  padding: 8px 0;
  text-align: left;
}
.product-category-fieldset {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 12px 12px;
  margin: 0;
}
.product-category-fieldset legend {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 600;
}
.product-category-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.product-category-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s, transform 0.12s;
}
.product-category-card:hover {
  border-color: #888;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.product-category-card:has(.product-category-card__input:checked) {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 4px 12px rgba(var(--brand-rgb), 0.24);
  transform: translateY(-1px);
}
.product-category-card__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.product-category-card__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--surface-muted);
}
.product-category-card:has(.product-category-card__input:checked) .product-category-card__icon {
  background: rgba(255, 255, 255, 0.14);
}
.product-category-card:has(.product-category-card__input:checked) .product-category-icon {
  filter: brightness(0) invert(1);
}
.product-category-card__body {
  min-width: 0;
}
.product-category-card__title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}
.product-category-card__desc {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.35;
}
.product-category-card:has(.product-category-card__input:checked) .product-category-card__desc {
  color: rgba(255, 255, 255, 0.78);
}
.product-category-head-icon {
  flex-shrink: 0;
  opacity: 0.85;
}
@media (max-width: 640px) {
  .product-category-options {
    grid-template-columns: 1fr;
  }
}
.product-manage-list .list-row:last-child { border-bottom: none; }
.list-row-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.list-row-title { font-weight: 600; }
.list-row-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.product-card-placeholder {
  height: 120px;
  background: var(--surface-muted);
}
.product-card-tag {
  display: inline-block;
  margin-bottom: 4px;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 10px;
  font-weight: 700;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0;
  border: 1px solid var(--line);
}
.product-category-block .product-grid {
  gap: 0;
}
.product-card {
  border: 1px solid var(--line);
  margin: -1px 0 0 -1px;
  background: var(--surface);
}
.product-card--intro {
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.product-card--intro:hover {
  background: var(--brand-soft);
  position: relative;
  z-index: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.product-card--intro:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}
.product-card img { width: 100%; height: 120px; object-fit: cover; background: var(--surface-muted); cursor: zoom-in; }
.product-card-body { padding: 10px 12px; }
.product-card-body h4 { margin: 0 0 4px; font-size: 14px; }
.product-card-body p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card-body .template { margin-top: 6px; color: var(--link); font-size: 12px; }

.product-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.45);
}
.product-detail-modal.hidden { display: none; }
.product-detail-dialog {
  position: relative;
  width: min(560px, 100%);
  max-height: min(88vh, 720px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.product-detail-close {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}
.product-detail-media img,
.product-detail-preview-img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  background: var(--surface-muted);
  cursor: zoom-in;
}
.product-detail-media img:hover,
.product-detail-preview-img:hover {
  opacity: 0.92;
}
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px 24px;
  background: rgba(0, 0, 0, 0.85);
  cursor: zoom-out;
}
.image-lightbox.hidden { display: none; }
.image-lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  cursor: default;
}
.image-lightbox-img {
  max-width: min(92vw, 1200px);
  max-height: min(78vh, 900px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
  background: #111;
  cursor: default;
}
.image-lightbox-close {
  position: absolute;
  right: 16px;
  z-index: 1;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.image-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.22);
}
.image-lightbox-caption {
  margin: 0;
  max-width: min(92vw, 720px);
  text-align: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.5;
}
.imposition-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2001;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 24px 20px;
  background: rgba(0, 0, 0, 0.88);
  cursor: zoom-out;
}
.imposition-lightbox.hidden { display: none; }
.imposition-lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  cursor: default;
}
.imposition-lightbox-canvas {
  display: block;
  width: min(92vw, 960px);
  height: min(72vh, 640px);
  background: #fafafa;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  box-shadow: 0 16px 56px rgba(0, 0, 0, 0.5);
  cursor: default;
}
.imposition-lightbox-caption {
  margin: 0;
  max-width: min(92vw, 960px);
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  line-height: 1.45;
}
.imposition-lightbox-hint {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
}

.product-detail-placeholder {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 13px;
}
.product-detail-body { padding: 16px 18px 20px; }
.product-detail-type {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--brand);
  font-weight: 600;
}
.product-detail-title {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.3;
}
.product-detail-field {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
}
.product-detail-desc {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}
.product-edit-dialog { padding: 18px 18px 20px; }
.product-edit-title { margin: 0 0 14px; font-size: 18px; }
.product-edit-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.list-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.list-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.list-row-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--surface-muted);
  cursor: zoom-in;
}
.list-row-main {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
  flex: 1;
}
.product-manage-toolbar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.product-manage-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.history-table th,
.history-table td {
  padding: 8px 12px;
  border: 1px solid var(--line);
  text-align: left;
}
.history-table th {
  color: var(--text);
  font-weight: 600;
  background: var(--surface-muted);
}
.history-table tbody tr:hover { background: #fafafa; }

.form-grid { display: grid; gap: 12px; max-width: 560px; }
.form-grid label { display: block; font-size: 12px; color: var(--muted); }
.form-grid input,
.form-grid textarea,
.form-grid select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 14px;
  background: var(--surface);
}
.form-grid textarea { min-height: 80px; resize: vertical; }
.form-grid .btn-primary { width: auto; }

.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--overlay);
  color: #fff;
  padding: 8px 16px;
  font-size: 12px;
  z-index: 9999;
}
.empty-tip { color: var(--muted); text-align: center; padding: 32px 16px; font-size: 13px; }
.msg-ok { color: var(--success); font-size: 12px; margin-top: 8px; }
.msg-err { color: var(--brand); font-size: 12px; margin-top: 8px; }
.detail-box {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  padding: 14px 16px;
  margin-top: 12px;
  font-size: 13px;
  white-space: pre-wrap;
}

/* design templates */
.template-meta {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 16px;
}
.template-search-form textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 120px;
}
.template-req-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.template-search-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.template-hint {
  color: var(--muted);
  font-size: 12px;
}
.template-results-head {
  margin: 20px 0 10px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.template-results-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
}
.template-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.template-table th,
.template-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
.template-table th {
  background: var(--surface-muted);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}
.template-table tr:last-child td { border-bottom: none; }
.template-title {
  font-weight: 600;
  margin-bottom: 4px;
}
.template-desc {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.template-file-size {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}
.match-reason {
  max-width: 180px;
  font-size: 12px;
  color: var(--muted);
}
.tag-chip {
  display: inline-block;
  border: 1px solid var(--line);
  padding: 1px 6px;
  margin: 0 4px 4px 0;
  font-size: 11px;
  background: var(--surface-muted);
}
.btn-download {
  display: inline-block;
  padding: 5px 12px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  white-space: nowrap;
}
.btn-download:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}
.template-upload-form input[type="file"] {
  margin-top: 4px;
}

/* manager dashboard */
.dashboard-wrap { display: flex; flex-direction: column; gap: 16px; }
.dashboard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.dashboard-title { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.dashboard-sub { margin: 0; font-size: 12px; color: var(--muted); }
.kpi-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-card.kpi-primary { border-color: var(--brand); background: var(--brand-soft); }
.kpi-num { font-size: 22px; font-weight: 700; line-height: 1.1; color: var(--brand); }
.kpi-label { font-size: 12px; color: var(--muted); }
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.dashboard-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.compass-panel .panel-body,
.gantt-panel .panel-body {
  overflow: auto;
  min-width: 0;
}
.compass-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 8px 16px;
  gap: 8px;
}
.compass-tip {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  max-width: 280px;
}
.compass-svg {
  display: block;
  width: 100%;
  max-width: 340px;
  height: auto;
}
.gantt-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.gantt-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}
.dot-quote { background: var(--brand); }
.dot-template { background: #333; }
.gantt-hourly {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 120px;
  padding: 0 4px 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.gantt-hour-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}
.gantt-hour-stack {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
}
.gantt-bar { width: 100%; min-height: 2px; border-radius: 2px 2px 0 0; }
.gantt-bar-quote { background: var(--brand); opacity: 0.85; }
.gantt-bar-template { background: #333; opacity: 0.75; }
.gantt-hour-label { font-size: 9px; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.gantt-timeline { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.gantt-lane {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}
.gantt-lane-label {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  line-height: 1.4;
  padding-top: 8px;
  white-space: nowrap;
}
.gantt-lane-main { min-width: 0; }
.gantt-lane-track {
  position: relative;
  min-height: 36px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  overflow: hidden;
}
.gantt-time-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.gantt-time-grid i {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px dashed #eee;
  width: 0;
}
.gantt-time-axis {
  position: relative;
  height: 18px;
  margin-top: 4px;
  font-size: 9px;
  color: #bbb;
}
.gantt-time-axis span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}
.gantt-task {
  position: absolute;
  height: 20px;
  border-radius: 4px;
  font-size: 10px;
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 6px;
  overflow: hidden;
  box-sizing: border-box;
  z-index: 1;
}
.gantt-task-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}
.gantt-task-compact { padding: 0; min-width: 6px; }
.gantt-task-quote { background: var(--brand); }
.gantt-task-template { background: #333; }
.gantt-empty { font-size: 11px; color: var(--muted); padding: 8px 10px; display: block; }

/* —— 电商增强 UI —— */
.chat-context-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}
.chat-context-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}
.chat-context-field select {
  min-width: 140px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
}
.hidden { display: none !important; }

.estimate-card { border-color: #f0ad4e; }
.estimate-badge { background: #f0ad4e; }
.estimate-tip { font-size: 11px; color: #b8860b; margin: 8px 0 0; display: flex; align-items: flex-start; gap: 6px; }
.estimate-tip-icon { flex-shrink: 0; margin-top: 1px; }
.quote-actions-extra { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }

.quote-logic-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
  flex-wrap: wrap;
}
.quote-logic-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}
.quote-logic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}
.quote-logic-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.quote-logic-chip:hover { border-color: var(--brand); }
.quote-logic-chip.active {
  border-color: var(--brand);
  background: var(--brand-soft, var(--brand-soft));
  color: var(--brand);
  font-weight: 600;
}
.quote-logic-icon {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.quote-logic-chip:not(.active) .quote-logic-icon {
  opacity: 0.5;
}
.chat-input-bar textarea:disabled { background: #f5f6f7; cursor: not-allowed; }

.heat-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.heat-red { background: var(--danger-soft); color: var(--brand); }
.heat-yellow { background: var(--warning-soft); color: var(--warning); }
.heat-green { background: var(--success-soft); color: var(--success); }

.follow-up-badge {
  margin-left: auto;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--warning-border);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.follow-up-badge:hover { filter: brightness(0.97); }
.follow-up-panel {
  position: fixed;
  top: 56px;
  right: 16px;
  width: min(360px, calc(100vw - 32px));
  max-height: 70vh;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 200;
  padding: 12px;
}
.follow-up-panel.hidden { display: none; }
.follow-up-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.follow-up-item:last-child { border-bottom: none; }
.follow-up-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }

.channel-funnel-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.funnel-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-muted);
}
.funnel-card h4 { margin: 0 0 8px; font-size: 14px; }
.funnel-stat { font-size: 12px; color: var(--muted); line-height: 1.6; }
.funnel-stat strong { color: var(--text); }

.template-search-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 16px;
  align-items: start;
}
.pref-sidebar {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-muted);
  position: sticky;
  top: 12px;
}
.pref-sidebar h4 { margin: 0 0 10px; font-size: 13px; }
.pref-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pref-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eee;
}
.pref-warn {
  margin-top: 10px;
  padding: 8px;
  border-radius: 6px;
  background: #fff3cd;
  color: #856404;
  font-size: 11px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.pref-warn-icon { flex-shrink: 0; margin-top: 1px; }

@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid-2 { grid-template-columns: 1fr; }
  .compass-svg { max-width: min(340px, 100%); margin: 0 auto; }
}

@media (max-width: 900px) {
  .app-root.layout-sidebar.has-products {
    grid-template-columns: var(--sidebar-w) 1fr;
  }
  .cs-products-wrap { display: none; }
}

/* ── 手动报价（材料+工艺） ── */
.main-content.manual-quote-view {
  overflow: hidden;
  padding: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.manual-quote-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  min-height: 0;
}
.manual-context-bar {
  display: flex; flex-wrap: wrap; gap: 12px; padding: 10px 16px;
  border-bottom: 1px solid var(--line); background: var(--surface); flex-shrink: 0;
}
.manual-context-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 160px; }
.manual-context-field select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.manual-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex-shrink: 0;
}
.manual-subtab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.manual-subtab:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.manual-subtab--active {
  border-color: var(--brand);
  background: var(--brand-soft, #fdeee9);
  color: var(--brand);
}
.manual-subtab em {
  font-style: normal;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 999px;
  background: #f0f0f0;
  color: var(--muted);
}
.manual-subtab--active em {
  background: rgba(192, 80, 60, 0.12);
  color: var(--brand);
}
.manual-subtab--soon:not(.manual-subtab--active) {
  color: var(--muted);
}
.manual-placeholder-col {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 48px 24px;
  overflow-y: auto;
}
.manual-placeholder {
  max-width: 420px;
  text-align: center;
  padding: 36px 28px;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.manual-placeholder-icon {
  font-size: 36px;
  margin-bottom: 12px;
}
.manual-placeholder-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
}
.manual-placeholder-desc,
.manual-placeholder-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}
.manual-placeholder-hint {
  margin-top: 12px;
  color: var(--brand);
}
.manual-heban-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 18px 28px;
}
.manual-heban-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.manual-heban-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.manual-heban-mode:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.manual-heban-mode--active {
  border-color: var(--brand);
  background: var(--brand-soft, #fdeee9);
  color: var(--brand);
}
.manual-heban-mode em {
  font-style: normal;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 999px;
  background: #f0f0f0;
  color: var(--muted);
}
.manual-heban-mode--soon:not(.manual-heban-mode--active) {
  color: var(--muted);
}
.manual-field-row {
  margin-bottom: 16px;
}
.manual-field-row .manual-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.manual-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.manual-field-row--size .manual-size-inputs {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.manual-size-x {
  padding-bottom: 8px;
  color: var(--muted);
  font-weight: 600;
}
.manual-input--qty {
  width: 120px;
}
.manual-phase-note--warn {
  color: #c0392b;
}
.manual-heban-formula {
  margin: 8px 0 0;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  background: #f8f8f8;
  border-radius: 6px;
  word-break: break-all;
}
.manual-heban-placeholder {
  padding: 24px 0;
}
.manual-placeholder--inline {
  border: none;
  background: transparent;
  max-width: none;
}
.manual-quote-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(380px, 34vw, 480px);
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}
.manual-side-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px 18px 28px;
  background: #fafafa;
  border-left: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.manual-detail-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  flex-shrink: 0;
}
.manual-detail-head {
  margin-bottom: 10px;
}
.manual-detail-title {
  font-size: 14px;
  font-weight: 700;
}
.manual-copy-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  flex-shrink: 0;
}
.manual-copy-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.manual-copy-title {
  font-size: 14px;
  font-weight: 700;
}
.manual-copy-hint {
  font-size: 11px;
  color: var(--muted);
}
.manual-tag-rope {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: #f9f9f9;
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.manual-tag-rope-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.manual-tag-rope-packs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.manual-tag-rope-packs .manual-input--num {
  width: 56px;
}
.manual-tag-rope-note {
  font-size: 11px;
  color: var(--muted);
}
.manual-copy-text {
  width: 100%;
  min-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
  background: #f9f9f9;
  color: var(--text);
}
.manual-copy-actions {
  margin-top: 10px;
}
.manual-copy-actions .btn-primary {
  width: 100%;
}
.manual-copy-total {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  text-align: right;
}
.manual-copy-total strong {
  font-size: 18px;
  color: var(--brand);
  margin-left: 6px;
}
.manual-shipping-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  flex-shrink: 0;
}
.manual-shipping-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.manual-shipping-region {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.manual-shipping-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.manual-shipping-select {
  padding: 6px 8px;
  font-size: 12px;
}
.manual-shipping-summary {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.manual-shipping-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.manual-shipping-row strong {
  color: var(--brand);
  font-size: 14px;
}
.manual-shipping-row--fee strong {
  font-size: 16px;
}
.manual-shipping-detail {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}
.manual-shipping-empty,
.manual-shipping-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.manual-profit-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  flex-shrink: 0;
}
.manual-profit-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.manual-profit-head-original {
  font-size: 12px;
  color: var(--muted);
}
.manual-profit-head-original strong {
  font-size: 15px;
  color: var(--text, #222);
  font-weight: 700;
}
.manual-opt-chip--original input:checked + span {
  border-color: #4a6f94;
  background: #4a6f94;
}
.manual-profit-original-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-muted, #f6f6f6);
}
.manual-profit-original-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text, #222);
}
.manual-profit-original-amt {
  font-size: 16px;
  color: #4a6f94;
}
.manual-profit-original-hint {
  font-size: 11px;
  color: var(--muted);
}
.manual-profit-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.manual-opt-chip--profit span {
  padding: 5px 10px;
  font-size: 12px;
  min-width: 44px;
  text-align: center;
}
.manual-profit-summary {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.manual-profit-formula-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 8px;
  font-size: 14px;
  line-height: 1.5;
}
.manual-profit-formula-line strong {
  color: var(--text);
}
.manual-profit-formula-op {
  color: var(--muted);
  font-size: 13px;
}
.manual-profit-formula-eq {
  color: var(--muted);
}
.manual-profit-result {
  font-size: 20px;
  color: var(--brand);
}
.manual-profit-formula-hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--muted);
}
.manual-profit-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.manual-profit-row em.manual-profit-formula {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}
.manual-profit-row--total {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
}
.manual-profit-row--total strong {
  font-size: 18px;
  color: var(--brand);
}
.manual-builder-col {
  overflow-y: auto;
  overflow-x: hidden;
  overflow-anchor: none;
  padding: 16px 20px 24px;
  border-right: 1px solid var(--line);
  min-height: 0;
  height: 100%;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.manual-builder {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

/* 客户样品照片 */
.manual-sample-photos {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.manual-sample-zone {
  padding: 12px 14px;
  outline: none;
  transition: background 0.15s, border-color 0.15s;
}
.manual-sample-zone:focus {
  background: rgba(74, 111, 148, 0.04);
}
.manual-sample-zone--drag {
  background: rgba(74, 111, 148, 0.08);
  box-shadow: inset 0 0 0 2px rgba(74, 111, 148, 0.25);
}
.manual-sample-zone-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
}
.manual-sample-zone-head .manual-label {
  font-size: 12px;
  color: var(--text, #222);
}
.manual-sample-hint {
  flex: 1;
  min-width: 140px;
  font-size: 11px;
  color: var(--muted);
}
.manual-sample-file-input {
  position: fixed;
  left: -100vw;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.manual-sample-empty {
  margin: 0;
  padding: 16px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-muted, #f8f8f8);
}
.manual-sample-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
}
.manual-sample-item {
  position: relative;
  margin: 0;
}
.manual-sample-view {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-muted, #f5f5f5);
  cursor: zoom-in;
}
.manual-sample-view img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}
.manual-sample-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
}
.manual-sample-item:hover .manual-sample-remove {
  opacity: 1;
}
.manual-sample-name {
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.manual-sample-count {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--muted);
}
.manual-sample-preview-card {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.manual-sample-preview-head {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}
.manual-sample-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.manual-sample-preview-thumb {
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--surface-muted, #f5f5f5);
}
.manual-sample-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.manual-sample-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: rgba(0, 0, 0, 0.88);
  cursor: zoom-out;
}
.manual-sample-lightbox-img {
  max-width: min(92vw, 1200px);
  max-height: min(85vh, 900px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
  cursor: default;
}
.manual-sample-lightbox-close {
  top: 16px;
}

.manual-section { margin-bottom: 18px; }
.manual-section-title { margin: 0 0 10px; font-size: 14px; font-weight: 700; }
.manual-material-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.manual-radio-chip {
  display: inline-flex; align-items: center; cursor: pointer;
}
.manual-radio-chip input { position: fixed; left: -100vw; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.manual-radio-chip span {
  padding: 8px 16px; border: 2px solid var(--line); border-radius: 8px;
  font-size: 13px; font-weight: 600; transition: all 0.12s;
}
.manual-radio-chip input:checked + span {
  border-color: var(--brand); background: var(--brand); color: #fff;
}
.manual-field--paper {
  margin-bottom: 4px;
}
.manual-field-grid--paper {
  margin-bottom: 4px;
}
.manual-field--paper-supplier {
  margin-bottom: 4px;
}
.manual-paper-presets--supplier {
  margin-top: -2px;
  margin-bottom: 8px;
}
.manual-paper-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-bottom: 12px;
  padding-left: 2px;
}
.manual-paper-presets-hint {
  font-size: 10px;
  color: var(--muted);
  opacity: 0.75;
}
.manual-paper-preset-btn {
  padding: 2px 8px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(0, 0, 0, 0.15);
  text-underline-offset: 2px;
}
.manual-paper-preset-btn:hover {
  color: var(--brand);
  text-decoration-color: var(--brand);
  background: rgba(192, 80, 60, 0.06);
}
.manual-field-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px;
}
.manual-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.manual-field--inline { flex-direction: row; align-items: center; gap: 6px; }
.manual-label { font-size: 11px; font-weight: 600; color: var(--muted); }
.manual-input {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff;
}
.manual-input--num { width: 88px; }

/* 三大板块：印前 / 印中 / 印后 */
.manual-phase {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.manual-phase--pre { border-left-color: #4a6f94; }
.manual-phase--press { border-left-color: var(--brand, #c0503c); }
.manual-phase--post { border-left-color: #4d7a55; }
.manual-phase-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.manual-phase--pre .manual-phase-head {
  background: linear-gradient(90deg, #e8f0f8 0%, #f5f8fb 100%);
}
.manual-phase--press .manual-phase-head {
  background: linear-gradient(90deg, #fdeee9 0%, #fbf6f4 100%);
}
.manual-phase--post .manual-phase-head {
  background: linear-gradient(90deg, #e8f3eb 0%, #f4f9f6 100%);
}
.manual-phase-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}
.manual-phase-badge--pre {
  background: linear-gradient(135deg, #6b93bc 0%, #4a6f94 100%);
}
.manual-phase-badge--press {
  background: linear-gradient(135deg, #d6654f 0%, #b8432f 100%);
}
.manual-phase-badge--post {
  background: linear-gradient(135deg, #7aab82 0%, #4d7a55 100%);
}
.manual-phase-desc {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  opacity: 0.75;
}
.manual-phase-body {
  padding: 12px 14px 14px;
}
.manual-phase-note {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--muted);
}
.manual-field-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.manual-field-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.manual-imposition-block {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f9f9f9;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.manual-imposition-derived {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.manual-imposition-derived > .manual-sheets-result,
.manual-imposition-derived > .manual-paper-match {
  margin-top: 0;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  border-top: 1px solid var(--line);
  align-self: stretch;
}
.manual-imposition-derived .manual-sheets-result {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.manual-imposition-derived .manual-sheets-value {
  width: 100%;
}
@media (max-width: 900px) {
  .manual-imposition-derived {
    grid-template-columns: 1fr;
  }
}
.manual-smart-impo {
  margin-top: 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.manual-impo-body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.manual-impo-form {
  flex: 1;
  min-width: 0;
}
.manual-impo-preview {
  flex: 0 0 168px;
  width: 168px;
}
@media (max-width: 520px) {
  .manual-impo-body {
    flex-direction: column;
  }
  .manual-impo-preview {
    flex: none;
    width: 100%;
    max-width: 240px;
  }
  .manual-impo-canvas {
    height: 140px;
  }
}
.manual-product-row--actions {
  margin-top: 10px;
  align-items: center;
  gap: 12px;
}
.manual-product-row--qty {
  margin-top: 4px;
}
.manual-product-mode-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 10px;
}
.manual-product-mode-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.manual-combined-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.manual-segment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.manual-segment-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.manual-segment-dims {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}
.manual-segment-unit {
  font-size: 12px;
  color: var(--muted);
}
.manual-segment-input {
  width: 72px;
}
.manual-segment-remove {
  align-self: flex-start;
  margin-top: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.manual-segment-remove:hover {
  color: #c0503c;
  border-color: #c0503c;
}
.manual-segment-add {
  align-self: flex-start;
}
.manual-stack-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.manual-stack-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.manual-product-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 10px;
}
.manual-product-input {
  width: 88px;
}
.manual-product-qty {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.manual-press-mode-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 8px;
}
.manual-press-mode-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.manual-imp-unit-note {
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}
.manual-impo-canvas {
  display: block;
  width: 100%;
  height: 120px;
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.manual-impo-canvas--zoom {
  cursor: zoom-in;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.manual-impo-canvas--zoom:hover,
.manual-impo-canvas--zoom:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(192, 80, 60, 0.15);
  outline: none;
}
.manual-impo-zoom-hint {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  opacity: 0.85;
}
.manual-imp-summary {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.35;
  color: var(--link, #5b7fa6);
  font-weight: 600;
}
.manual-imp-summary--empty {
  color: var(--muted);
  font-weight: 400;
}
.manual-imposition-title {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.manual-imposition-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 10px;
}
.manual-imposition-input {
  width: 100px;
}
.manual-imposition-x {
  font-size: 14px;
  color: var(--muted);
  padding-bottom: 8px;
  line-height: 1;
}
.manual-imposition-ups {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}
.manual-sheets-hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--link, #5b7fa6);
}
.manual-sheets-result {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #ddd;
}
.manual-sheets-result--empty {
  opacity: 0.72;
}
.manual-sheets-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  min-width: 42px;
  flex-shrink: 0;
}
.manual-sheets-placeholder {
  font-size: 12px;
  color: var(--muted);
}
.manual-sheets-value {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}
.manual-sheets-total {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand, #c0503c);
  line-height: 1;
}
.manual-sheets-unit {
  font-size: 13px;
  color: var(--muted);
}
.manual-sheets-formula {
  font-size: 11px;
  color: var(--muted);
  padding: 3px 8px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.manual-print-match-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--link, #5b7fa6);
}
.manual-print-match-hint strong {
  color: var(--brand, #c0503c);
  font-weight: 700;
}
.manual-print-match-format {
  color: var(--muted);
  font-size: 11px;
}
.manual-print-match-warn {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  color: #b45309;
}
.manual-paper-match {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #ddd;
}
.manual-paper-match-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.manual-paper-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.manual-paper-selected {
  font-size: 13px;
  color: var(--text);
}
.manual-paper-selected strong {
  color: var(--brand, #c0503c);
  font-weight: 700;
}
.manual-paper-note {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.manual-print-types {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.manual-print-catalog {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.manual-print-catalog--hidden {
  display: none !important;
}
.manual-print-auto {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.manual-print-auto-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.manual-print-auto-value em {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 500;
  font-style: normal;
  color: var(--muted);
}
.manual-print-side-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.manual-print-side-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.manual-print-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.manual-print-vendor {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  min-width: 64px;
}
.manual-print-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}
.manual-spot-field { margin-top: 8px; }

.manual-breakdown-phase {
  margin-bottom: 10px;
}
.manual-breakdown-phase-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.manual-breakdown-phase-sub {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

/* 后道工艺 chip */
.manual-craft-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.manual-toggle-chip {
  display: inline-flex;
  cursor: pointer;
  user-select: none;
}
.manual-toggle-chip input {
  position: fixed;
  left: -100vw;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.manual-toggle-chip span {
  display: inline-block;
  padding: 7px 14px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: #fff;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.manual-toggle-chip:hover span { border-color: #aaa; }
.manual-toggle-chip input:checked + span,
.manual-toggle-chip--on span {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}
.manual-toggle-chip--active span {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand);
}
.manual-craft-options {
  margin-top: 10px;
  padding: 10px 12px;
  background: #f7f7f7;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.manual-craft-opt-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-height: 28px;
}
.manual-craft-opt-group--hint { gap: 8px; }
.manual-craft-opt-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  min-width: 28px;
  flex-shrink: 0;
}
.manual-craft-opt-label {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}
.manual-craft-opt-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.manual-opt-chip {
  display: inline-flex;
  cursor: pointer;
}
.manual-opt-chip input {
  position: fixed;
  left: -100vw;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.manual-opt-chip span {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: #fff;
  border: 1px solid #ddd;
  color: var(--text);
  transition: all 0.12s;
}
.manual-opt-chip input:checked + span {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.manual-craft-note {
  font-size: 11px;
  color: var(--muted);
}
.manual-craft-foil-colors {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.manual-section--result { background: var(--surface-muted); border-radius: 10px; padding: 12px; }
.manual-result-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.manual-result-head .manual-section-title { margin: 0; }
.manual-result-error { font-size: 12px; color: #c0392b; margin: 0 0 8px; }
.manual-result-empty { font-size: 12px; color: var(--muted); margin: 0; }
.manual-breakdown { font-size: 12px; }
.manual-breakdown-row {
  display: grid; grid-template-columns: 100px 1fr auto; gap: 8px;
  padding: 6px 0; border-bottom: 1px dashed var(--line); align-items: start;
}
.manual-side-panel .manual-breakdown-row {
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "name amt"
    "spec spec";
  gap: 4px 10px;
  padding: 8px 0;
}
.manual-side-panel .manual-breakdown-name { grid-area: name; font-size: 13px; }
.manual-side-panel .manual-breakdown-spec {
  grid-area: spec;
  font-size: 11px;
  word-break: break-word;
}
.manual-side-panel .manual-breakdown-amt {
  grid-area: amt;
  font-size: 13px;
  align-self: start;
}
.manual-breakdown-row--sub {
  padding-left: 8px;
  opacity: 0.92;
}
.manual-breakdown-row--sub .manual-breakdown-name {
  font-size: 11px;
  color: var(--muted);
}
.manual-side-panel .manual-breakdown-phase-head {
  margin-bottom: 6px;
}
.manual-side-panel .manual-breakdown-total {
  font-size: 14px;
  margin-top: 8px;
}
.manual-side-panel .manual-detail-card,
.manual-side-panel .manual-shipping-card,
.manual-side-panel .manual-copy-card {
  padding: 16px;
}
.manual-breakdown-row--est .manual-breakdown-name em {
  font-style: normal; font-size: 10px; background: #fff3cd; color: #856404;
  padding: 0 4px; border-radius: 3px; margin-left: 4px;
}
.manual-breakdown-name { font-weight: 600; }
.manual-breakdown-spec { color: var(--muted); font-size: 11px; line-height: 1.4; }
.manual-breakdown-amt { font-weight: 700; color: var(--brand); white-space: nowrap; }
.manual-breakdown-total {
  display: flex; justify-content: space-between; padding-top: 10px; margin-top: 4px;
  font-size: 13px; font-weight: 600;
}
.manual-breakdown-total strong { font-size: 18px; color: var(--brand); }
.manual-preview-col {
  padding: 14px;
  flex: 0 1 auto;
  min-height: 0;
  max-height: min(48vh, 420px);
  overflow-y: auto;
  overflow-anchor: none;
}
.manual-preview-live {
  font-size: 10px;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-soft, rgba(192, 80, 60, 0.12));
  border-radius: 4px;
  padding: 2px 6px;
}
.manual-preview-phase { margin-bottom: 8px; }
.manual-preview-phase-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.manual-preview-jpg {
  padding: 0 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
.manual-preview-jpg-img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.manual-quote-history {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.manual-quote-history-head {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}
.manual-quote-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.manual-quote-history-btn {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.manual-quote-history-btn:hover {
  border-color: var(--brand);
  background: #fffaf8;
}
.manual-quote-history-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.manual-quote-history-meta {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}
.manual-quote-form { flex: 1 1 auto; padding: 12px 14px; overflow-y: auto; min-height: 0; overflow-anchor: none; }
.manual-lines-wrap { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 10px; }
.manual-lines-head { display: flex; justify-content: space-between; padding: 6px 10px; background: #eee; font-size: 12px; font-weight: 600; }
.manual-lines-scroll { overflow-x: auto; }
.manual-lines-empty { text-align: center; color: var(--muted); padding: 16px !important; font-size: 12px; }
.manual-lines-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.manual-lines-table th, .manual-lines-table td { padding: 5px 6px; border-top: 1px solid var(--line); }
.manual-lines-table th { background: #fafafa; color: var(--muted); font-weight: 600; }
.manual-lines-table .manual-input { padding: 4px 6px; min-width: 56px; width: 100%; }
.manual-line-amount { font-weight: 700; color: var(--brand); white-space: nowrap; }
.manual-total-label { text-align: right !important; font-weight: 600; }
.manual-total-value { font-size: 14px; font-weight: 700; color: var(--brand); }
.manual-form-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.manual-form-foot .manual-input { flex: 1; min-width: 120px; }
.manual-preview-card { height: fit-content; }
.manual-preview-id { margin-left: 6px; font-size: 10px; opacity: 0.7; }
.manual-preview-body { padding: 10px 12px; }
.manual-preview-product { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.manual-preview-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 4px; padding: 4px 0;
  border-bottom: 1px dashed var(--line); font-size: 11px;
}
.manual-preview-row em { display: block; font-style: normal; color: var(--muted); font-size: 10px; }
.manual-preview-meta { color: var(--muted); }
.manual-preview-amt { font-weight: 600; }
.manual-preview-total { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 6px; border-top: 2px solid var(--line); }
.manual-preview-total strong { font-size: 16px; color: var(--brand); }
.manual-preview-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; }
@media (max-width: 1100px) {
  .manual-quote-body {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 400px);
  }
}
@media (max-width: 960px) {
  .main-content.manual-quote-view {
    overflow-y: auto;
  }
  .manual-subtabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .manual-subtab {
    flex-shrink: 0;
  }
  .manual-quote-wrap {
    height: auto;
    min-height: 100%;
  }
  .manual-quote-body {
    grid-template-columns: 1fr;
    overflow: visible;
    height: auto;
  }
  .manual-builder-col {
    border-right: none;
    border-bottom: 1px solid var(--line);
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .manual-side-panel {
    height: auto;
    max-height: none;
    overflow: visible;
    border-left: none;
    border-top: 1px solid var(--line);
    padding-bottom: 32px;
  }
}
