:root {
  --bg: #f5f7f6;
  --panel: #ffffff;
  --ink: #17201b;
  --muted: #65736b;
  --line: #dbe3de;
  --soft: #eef3f0;
  --accent: #126a55;
  --accent-2: #b56b2a;
  --danger: #b43939;
  --shadow: 0 18px 45px rgba(30, 44, 37, 0.08);
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
  touch-action: manipulation;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 10000;
  padding: 8px 12px;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  transform: translateY(-150%);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

h1, h2, h3, h4 {
  scroll-margin-top: 72px;
  text-wrap: balance;
}

[hidden] {
  display: none !important;
}

.field-error {
  display: block;
  margin-top: 6px;
  color: #b42318;
  font-size: 12px;
  line-height: 1.4;
}

.field-error[hidden] {
  display: none;
}

input[aria-invalid="true"] {
  border-color: #d92d20;
  box-shadow: 0 0 0 2px rgba(217, 45, 32, 0.12);
}

.app-shell {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 56px;
  background: #17201b;
  color: #f8fbf9;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 max(18px, calc((100vw - 1480px) / 2));
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: max-content;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #e8b15f;
  color: #17201b;
  font-weight: 800;
  letter-spacing: 0;
}

.brand h1,
.brand p,
.topbar h2,
.section-title h3,
.table-toolbar h3,
.dialog-head h3,
.notes-panel h3 {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.25;
}

.nav {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  gap: 4px;
}

#accountRole {
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.nav-item {
  width: auto;
  min-height: 56px;
  border: 0;
  border-radius: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: rgba(255, 255, 255, 0.76);
  text-align: center;
  padding: 0 14px;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.06);
  border-bottom-color: #e8b15f;
  color: #fff;
}

body.locked .admin-nav-item {
  display: none;
}

.admin-card {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-card strong {
  display: block;
  font-size: 13px;
}

.admin-actions {
  display: flex;
}

.admin-actions.logged-in {
  grid-template-columns: 1fr;
}

.admin-actions.logged-in input {
  display: none;
}

.admin-actions input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 6px;
  padding: 8px 9px;
}

.admin-actions input::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

.main {
  min-width: 0;
  padding: 24px;
  max-width: 1480px;
  margin: 0 auto;
}

.topbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.topbar h2 {
  font-size: 26px;
  line-height: 1.15;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.eyebrow {
  display: inline-block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 6px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.quote-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 14px;
  align-items: start;
}

.result-panel {
  position: sticky;
  top: 72px;
}

:where(button, input, select, textarea, summary):focus-visible {
  outline: 3px solid rgba(20, 120, 100, 0.28);
  outline-offset: 2px;
}

.panel,
.result-card,
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-panel,
.table-panel,
.notes-panel {
  padding: 18px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 3px 0 14px;
}

.section-title h3,
.table-toolbar h3,
.notes-panel h3 {
  font-size: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.quote-section {
  margin: 18px 0 22px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfb;
}

.quote-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.quote-section-heading h3 {
  margin: 0;
  font-size: 15px;
  color: var(--ink);
}

.quote-section .form-grid {
  margin-bottom: 0;
}

.quote-baseline-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.quote-baseline-grid > label {
  grid-template-rows: auto 40px;
  align-content: start;
}

.quote-baseline-grid input,
.quote-baseline-grid select {
  height: 40px;
}

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

.valve-kind-card {
  display: grid;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.valve-kind-card:hover:not(:disabled) {
  border-color: #88b8a8;
  transform: translateY(-1px);
}

.valve-kind-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(18, 106, 85, 0.14);
}

.valve-kind-card.is-disabled,
.valve-kind-card:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.valve-kind-card-media {
  position: relative;
  display: grid;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, #eef4f1, #e2ece7);
  color: #6c7b74;
  font-size: 12px;
}

.valve-kind-card-media::before {
  content: "";
  position: absolute;
  inset: 18%;
  border: 1px dashed #aec2b8;
  border-radius: 10px;
}

.valve-kind-card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}

.valve-kind-card.has-image .valve-kind-card-media img {
  opacity: 1;
}

.valve-kind-card.has-image .valve-kind-card-placeholder,
.valve-kind-card.has-image .valve-kind-card-media::before {
  opacity: 0;
}

.valve-kind-card-content {
  display: grid;
  gap: 4px;
  padding: 10px 11px 11px;
}

.valve-kind-card-content strong {
  font-size: 14px;
}

.valve-kind-card-state,
.valve-kind-card-disabled {
  color: var(--muted);
  font-size: 12px;
}

.valve-kind-card.is-selected .valve-kind-card-state {
  color: var(--accent);
  font-weight: 700;
}

.supplemental-fee-grid input {
  height: 36px;
  min-height: 36px;
  line-height: 1.2;
}

.quick-open-fixed-accessories {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid #dce9e4;
  border-radius: 8px;
  background: #f8fbf9;
}

.quick-open-fixed-accessories summary {
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.quick-open-fixed-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.quick-open-fixed-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.quick-open-fixed-list strong {
  color: var(--ink);
  font-weight: 600;
}

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

.product-spec-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.product-order-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.dimension-group {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.dimension-group + .dimension-group {
  margin-top: 10px;
}

.dimension-group h4 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ink);
}

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

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

.accessory-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.accessory-card {
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.accessory-card h4,
.accessory-card p {
  margin: 0;
}

.accessory-card h4 {
  color: var(--ink);
  font-size: 13px;
}

.accessory-card p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.accessory-card.is-fixed {
  background: var(--soft);
}

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

.slow-accessories-section .slow-open-accessories {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.slow-accessories-section .slow-open-accessories > fieldset {
  grid-column: auto;
}

.direct-accessory-layout {
  display: grid;
  gap: 9px;
}

.direct-accessory-row {
  display: grid;
  grid-template-columns: repeat(var(--card-count), minmax(0, 1fr));
  gap: 9px;
  align-items: start;
}

.direct-accessory-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.direct-accessory-card.is-fixed {
  background: #f0f3f1;
  color: var(--muted);
}

.direct-accessory-card h4 {
  margin: 0 0 9px;
  font-size: 13px;
  color: var(--ink);
}

.direct-accessory-card.seal-card {
  grid-column: 1 / -1;
}

.direct-accessory-option {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 7px 0 0;
  color: var(--ink);
  cursor: pointer;
}

.direct-accessory-option input {
  width: auto;
  min-height: 16px;
  padding: 0;
}

.direct-accessory-option input[type="radio"] {
  appearance: auto;
  width: 16px;
  height: 16px;
  min-height: 16px;
  border-radius: 50%;
  padding: 0;
  margin: 0;
}

.direct-accessory-option small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.direct-seal-copper-panel {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.direct-accessory-fixed {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid #dce9e4;
  border-radius: 8px;
  background: #f8fbf9;
}

.direct-accessory-fixed summary {
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.direct-accessory-fixed-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.direct-accessory-fixed-row strong {
  color: var(--ink);
  font-weight: 600;
}

.quote-section small {
  color: var(--muted);
  font-size: 12px;
}

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

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  outline: none;
}

input[type="radio"],
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  flex: 0 0 16px;
  accent-color: var(--accent);
}

input[type="radio"] {
  border-radius: 50%;
}

input[type="checkbox"] {
  border-radius: 4px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 106, 85, 0.12);
}

textarea {
  resize: vertical;
  min-height: 88px;
}

input[readonly] {
  background: var(--soft);
  color: #304139;
}

.slow-open-mode [data-valve-mode="quick-open"] {
  display: none !important;
}

.product-preview {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  margin: 0 0 22px;
}

.product-preview strong {
  display: block;
  font-size: 16px;
}

.product-preview p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.customer-image-layout {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 128px;
  gap: 16px;
  align-items: start;
}

.customer-image-upload {
  min-height: 128px;
  place-content: center;
  padding: 18px;
  border: 1px dashed #aebfb6;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.uploaded-image-preview {
  width: 128px;
  min-height: 128px;
  aspect-ratio: 1 / 1;
  border: 1px dashed #b7c5bd;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  background: #fbfcfb;
  margin: 0;
}

.uploaded-image-preview img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  display: block;
  margin-bottom: 8px;
}

.form-actions,
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.primary-button,
.ghost-button,
.small-button,
.icon-button,
.danger-button {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 0 14px;
}

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

.ghost-button {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.small-button {
  background: #e8b15f;
  color: #17201b;
  padding: 0 10px;
}

.icon-button {
  width: 36px;
  padding: 0;
  background: #fff;
  border-color: var(--line);
  font-size: 20px;
  line-height: 1;
}

.danger-button {
  background: #fff;
  color: var(--danger);
  border-color: #efd1d1;
}

.file-trigger {
  position: relative;
  display: inline-grid;
  place-items: center;
}

.file-trigger input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.result-panel {
  display: grid;
  gap: 14px;
}

.result-card {
  padding: 18px;
}

.primary-result {
  background: #123f35;
  border-color: #123f35;
  color: #fff;
}

.primary-result span,
.primary-result small {
  color: rgba(255, 255, 255, 0.72);
}

.primary-result .ton-price-primary,
#tonPricePrimary {
  color: rgba(255, 255, 255, 0.86);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.primary-result strong {
  display: block;
  font-size: 36px;
  line-height: 1.1;
  margin: 8px 0;
}

.result-card span,
.result-card small {
  display: block;
  font-size: 12px;
}

.notes-panel ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 13px;
}

.breakdown-panel {
  padding: 16px;
}

.breakdown-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.breakdown-head h3 {
  margin: 0;
  font-size: 16px;
}

.breakdown-head strong {
  font-size: 20px;
  color: var(--accent);
}

.breakdown-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.breakdown-row span {
  color: var(--muted);
}

.breakdown-row strong {
  font-size: 15px;
}

.range-row strong {
  color: var(--accent-2);
}

.sub-breakdown {
  display: grid;
  gap: 7px;
  padding: 2px 0 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.sub-breakdown span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.sub-breakdown strong {
  color: var(--ink);
}

.cost-tree {
  border-top: 1px solid var(--line);
}

.cost-tree-category {
  border-bottom: 1px solid var(--line);
}

.cost-tree-category > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
}

.cost-tree-category > summary {
  cursor: pointer;
  list-style: none;
}

.cost-tree-category > summary::-webkit-details-marker {
  display: none;
}

.cost-tree-category > summary strong {
  color: var(--ink);
  font-weight: 700;
}

.cost-tree-category ul {
  margin: 0 0 12px;
  padding: 0 0 0 20px;
  list-style: none;
}

.cost-tree-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.cost-status {
  display: inline-flex;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.72rem;
}

.cost-status.provisional {
  color: #8a5a00;
  background: #fff3cd;
}

.cost-status.pending {
  color: #7a3e00;
  background: #ffe5cc;
}

.cost-item-meta {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.cost-warning {
  margin: 10px 0 0;
  color: #a64b00;
  font-size: 12px;
  line-height: 1.5;
}

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

.records-workspace {
  display: grid;
  gap: 16px;
}

.quotation-workspace-view {
  max-width: 1440px;
  margin: 0 auto;
}

.quotation-workspace-intro {
  margin: -7px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.workspace-tabs {
  display: flex;
  gap: 22px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.workspace-tabs button {
  position: relative;
  min-height: 42px;
  border: 0;
  padding: 0 2px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.workspace-tabs button[aria-selected="true"] {
  color: var(--accent);
}

.workspace-tabs button[aria-selected="true"]::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--accent);
  content: "";
}

.records-workspace-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(350px, 390px);
  gap: 14px;
  align-items: start;
}

.quotation-record-panel,
.current-quotation-panel {
  min-width: 0;
}

.quotation-record-heading {
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.quotation-record-filters {
  grid-template-columns: 1.2fr 1.1fr .8fr;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #e0e9e5;
  border-radius: 8px;
  background: #f9fcfa;
}

.quotation-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  padding: 9px 10px;
  border: 1px solid #a8cabc;
  border-radius: 6px;
  background: #edf7f2;
  color: #305e50;
}

.quotation-selection-actions {
  display: flex;
  gap: 8px;
}

.quote-record-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 6px;
  color: var(--muted);
  font-size: 12px;
}

.quote-record-page-head label {
  display: flex;
  align-items: center;
  gap: 7px;
}

.quote-record-page-head input,
.quote-record-select input {
  width: 17px;
  height: 17px;
  min-height: 17px;
  margin: 0;
  accent-color: var(--accent);
}

.quote-record-list {
  border-top: 1px solid var(--line);
}

.quote-record-row {
  display: grid;
  grid-template-columns: 24px 52px minmax(170px, 1.35fr) minmax(330px, 2fr) 28px;
  gap: 9px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  transition: background-color 140ms ease;
}

.quote-record-row.is-selected {
  background: linear-gradient(90deg, #f2faf6 0, #fff 44%);
}

.quote-record-product {
  min-width: 0;
}

.quote-record-product strong,
.quote-record-product small {
  display: block;
}

.quote-record-product strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-record-product small,
.quote-record-financials small,
.quote-record-context {
  color: var(--muted);
}

.quote-record-product small {
  margin-top: 4px;
}

.quote-record-financials {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 9px;
}

.quote-record-financials span {
  display: grid;
  gap: 3px;
}

.quote-record-financials strong {
  font-size: 13px;
}

.quote-record-context {
  grid-column: 3 / 5;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  font-size: 11px;
}

.quote-record-context span + span {
  margin-left: 11px;
  padding-left: 11px;
  border-left: 1px solid var(--line);
}

.quote-record-internal-mobile {
  display: none;
}

.quote-record-menu {
  position: relative;
  align-self: center;
}

.quote-record-menu > summary {
  display: grid;
  place-items: center;
  width: 28px;
  height: 32px;
  cursor: pointer;
  list-style: none;
  font-size: 20px;
}

.quote-record-menu > summary::-webkit-details-marker {
  display: none;
}

.quote-record-menu > div {
  position: absolute;
  z-index: 5;
  top: 34px;
  right: 0;
  display: grid;
  min-width: 118px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(20, 55, 43, .14);
}

.quote-record-menu button,
.quote-record-menu-upload {
  position: relative;
  border: 0;
  padding: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.quote-record-menu-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.current-quotation-panel {
  position: sticky;
  top: 12px;
  overflow: hidden;
  padding: 0;
}

.current-quotation-head {
  padding: 15px 16px;
  background: #17483d;
  color: #f8fcfa;
}

.current-quotation-head h3,
.current-quotation-head p {
  margin: 0;
}

.current-quotation-head p {
  margin-top: 5px;
  color: #bdd2c9;
  font-size: 11px;
  line-height: 1.5;
}

.current-quotation-items,
.quotation-basic-fields,
.quotation-advanced-fields {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.current-quotation-items {
  display: grid;
  gap: 0;
}

.current-quotation-item {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.current-quotation-item:last-child {
  border-bottom: 0;
}

.current-quotation-item-main {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
}

.current-quotation-item-main small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.current-quotation-thumb {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border-radius: 6px;
  background: #e9f1ed;
  color: var(--accent);
  font-weight: 800;
}

.current-quotation-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.current-item-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 7px;
}

.current-item-actions button {
  min-height: 28px;
  border: 0;
  padding: 3px 6px;
  background: transparent;
  color: var(--accent);
  font-size: 11px;
  cursor: pointer;
}

.current-item-actions button:last-child {
  color: #9c473a;
}

.current-item-actions button:disabled {
  opacity: .38;
  cursor: not-allowed;
}

.current-quotation-total {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fbf9;
  color: var(--accent);
  font-size: 16px;
  font-weight: 800;
  text-align: right;
}

.quotation-basic-fields h4 {
  margin: 0 0 10px;
}

.quotation-advanced-fields > summary {
  cursor: pointer;
  color: #345e51;
  font-weight: 750;
}

.quotation-advanced-fields > summary small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 400;
}

.quotation-advanced-fields[open] > summary {
  margin-bottom: 12px;
}

.quotation-internal-note {
  margin: 12px 14px 0;
  padding: 9px 10px;
  border-radius: 6px;
  background: #edf6f1;
  color: #3d6c5d;
  font-size: 11px;
  line-height: 1.5;
}

.current-quotation-panel .quotation-draft-actions {
  padding: 12px 14px 14px;
}

.quotation-item-dialog-card {
  width: min(860px, calc(100vw - 32px));
  max-height: min(840px, calc(100vh - 32px));
  overflow: auto;
}

.quotation-item-dialog-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quotation-item-image-preview {
  display: grid;
  place-items: center;
  min-height: 90px;
  overflow: hidden;
  border: 1px dashed var(--line);
  border-radius: 7px;
  background: #f8fbf9;
}

.quotation-item-image-preview img {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
}

.quotation-logistics-fields {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.quotation-logistics-fields summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.quotation-logistics-fields[open] .draft-logistics-grid {
  margin-top: 12px;
}

.compact-fields {
  margin-top: 12px;
  margin-bottom: 14px;
}

.quotation-record-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.quotation-record-secondary-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.quotation-record-secondary-actions button {
  white-space: nowrap;
}

.quotation-record-actions button {
  white-space: nowrap;
}

.record-item {
  display: grid;
  grid-template-columns: auto 76px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
}

.record-item input {
  width: 18px;
  min-height: 18px;
}

.select-all-cell {
  display: grid;
  place-items: center;
  gap: 3px;
  font-size: 12px;
}

.select-all-cell input {
  width: 16px;
  height: 16px;
}

.record-thumb {
  width: 58px;
  height: 58px;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  background: var(--soft);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
}

.record-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.record-main {
  min-width: 0;
}

.record-main strong,
.record-main small {
  display: block;
}

.record-main small {
  color: var(--muted);
  margin-top: 5px;
}

.record-price {
  font-weight: 700;
  color: var(--accent);
}

.record-image-upload {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  aspect-ratio: 1 / 1;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  overflow: hidden;
  cursor: pointer;
}

.record-image-upload img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.record-image-upload button {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: transparent;
  cursor: pointer;
}

.record-image-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

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

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.history-item.deleted {
  background: #f6f7f5;
  color: #68746d;
}

.history-item strong,
.history-item small {
  display: block;
}

.history-item small {
  margin-top: 5px;
  color: var(--muted);
}

.history-meta {
  display: grid;
  gap: 6px;
  justify-items: end;
  min-width: 220px;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.quotation-draft-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.draft-logistics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
}

.draft-logistics-grid label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.pagination-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.pagination-actions .ghost-button {
  min-height: 32px;
  padding: 0 10px;
}

.pagination-actions .ghost-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.mini-upload {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  white-space: nowrap;
}

.mini-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: #fff;
}

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

.table-toolbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  text-align: left;
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--soft);
  color: #304139;
  font-weight: 700;
}

td {
  color: #2c3832;
}

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

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

.locked .admin-only {
  opacity: 0.5;
  pointer-events: none;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  width: min(760px, calc(100vw - 32px));
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.2);
}

dialog::backdrop {
  background: rgba(15, 25, 20, 0.36);
}

.dialog-card {
  padding: 18px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.dialog-head h3 {
  font-size: 20px;
}

.dialog-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  max-height: min(64vh, 640px);
  overflow: auto;
  padding: 3px 3px 14px;
}

.dialog-fields label.wide {
  grid-column: 1 / -1;
}

.dialog-image-upload {
  position: relative;
  display: grid;
  place-items: center;
  width: 128px;
  height: 128px;
  aspect-ratio: 1 / 1;
  margin-top: 7px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  overflow: hidden;
  cursor: pointer;
}

.dialog-image-upload img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.dialog-image-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dialog-actions {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.slow-open-fields {
  display: grid;
  gap: 22px;
  margin-top: 22px;
}

.slow-open-accessories,
.slow-copper-secondary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

.slow-copper-primary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.wide-slow-field,
.slow-open-accessories .wide-field {
  grid-column: 1 / -1;
}

.segmented-field,
.slow-part-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
}

.compact-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.compact-options legend {
  width: 100%;
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.compact-options label {
  display: inline-flex;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  color: var(--ink);
  cursor: pointer;
}

.part-dimensions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  grid-column: 1 / -1;
}

.plate-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  grid-column: 1 / -1;
}

.segmented-field legend,
.slow-part-panel h4 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.segmented-field label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  margin: 0 12px 8px 0;
  color: var(--ink);
  cursor: pointer;
}

.segmented-field input {
  width: auto;
}

/* ── 配件区 fieldset 内左右布局 ── */
.accessory-row {
  display: flex;
  flex-direction: row;
  gap: 18px;
  align-items: flex-start;
  width: 100%;
}
.accessory-left,
.accessory-right {
  flex: 1;
  min-width: 0;
}
.accessory-sub-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

/* 铜件重量 (可选填) 提示 */
.optional-hint {
  font-size: 12px;
  color: #999;
  font-weight: 400;
}

/* 卡簧规格禁用态 */
select:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.slow-part-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px 12px;
  align-content: start;
}

.slow-part-panel h4 {
  grid-column: 1 / -1;
}

.slow-part-panel label {
  display: grid;
  gap: 6px;
}

.inline-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.slow-linkage-summary {
  border: 1px dashed #b9c8c0;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fbfcfb;
  color: var(--muted);
  display: grid;
  gap: 6px;
}

.direct-turning-fields {
  margin-top: 0;
}

.direct-turning-copper-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.direct-part-panel,
.direct-accessory-panel,
.direct-seal-copper-panel {
  padding: 12px;
  border: 1px solid #d9e9e3;
  border-radius: 10px;
  background: #fff;
}

.direct-part-panel h4,
.direct-accessory-panel h4,
.direct-seal-copper-panel h4 {
  margin: 0 0 10px;
}

.direct-part-panel label {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.direct-accessory-group {
  display: grid;
  gap: 6px;
  padding: 10px 0;
  border-top: 1px dashed #dce9e4;
}

.direct-accessory-group:first-child { border-top: 0; }
.direct-accessory-option { display: flex; gap: 8px; align-items: center; }
.direct-accessory-option small { color: #64756f; }
.direct-accessory-choice {
  appearance: auto;
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  margin: 0;
  accent-color: var(--accent);
}
.direct-accessory-choice:disabled { opacity: .62; cursor: not-allowed; }
.direct-turning-details-list {
  display: grid;
  gap: 6px;
}

.direct-turning-copper-table {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) repeat(3, minmax(96px, 1fr));
  border: 1px solid #dce9e4;
  border-radius: 8px;
  overflow: hidden;
}

.direct-turning-copper-table > * {
  padding: 9px 10px;
  border-bottom: 1px solid #edf2ef;
}

.direct-turning-copper-head {
  font-weight: 700;
  background: #f5faf7;
}

.direct-turning-copper-total {
  display: grid;
  place-items: center;
  gap: 4px;
  font-weight: 700;
  background: #f5faf7;
}

.direct-cost-tree-category {
  border-top: 1px solid #e4ece8;
  padding: 9px 0;
}

.direct-cost-tree-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
}

@media (max-width: 760px) {
  .direct-turning-copper-grid { grid-template-columns: 1fr; }
}

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

  .current-quotation-panel {
    position: static;
  }

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

  .result-panel {
    position: static;
  }

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

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

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

  .quotation-record-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 760px) {
  .app-header {
    position: static;
    flex-wrap: wrap;
    gap: 6px 12px;
    padding: 8px 12px 0;
  }

  .brand-mark {
    display: none;
  }

  .nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .nav-item {
    min-height: 44px;
    white-space: nowrap;
  }

  .main {
    padding: 16px;
  }

  .topbar,
  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-actions {
    justify-content: flex-start;
  }

  .draft-logistics-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .quotation-record-actions {
    display: grid;
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .quotation-record-secondary-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .quotation-record-filters {
    grid-template-columns: 1fr;
  }

  .quotation-selection-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .quotation-selection-actions {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    width: 100%;
  }

  .quote-record-row {
    grid-template-columns: 24px 48px minmax(0, 1fr) 28px;
  }

  .quote-record-financials {
    grid-column: 3 / 4;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quote-record-context {
    grid-column: 3 / 4;
    overflow: hidden;
  }

  .quote-record-context span:nth-child(n+4) {
    display: none;
  }

  .quote-record-internal-desktop {
    display: none !important;
  }

  .quote-record-internal-mobile {
    grid-column: 3 / 4;
    display: flex;
    gap: 10px;
    color: var(--muted);
    font-size: 11px;
  }

  .quote-record-internal-mobile:not([open]) > span {
    display: none;
  }

  .quotation-record-actions button {
    width: 100%;
  }

  .quotation-draft-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .quotation-draft-actions button {
    width: 100%;
  }

  .topbar-actions,
  .form-actions,
  .dialog-actions {
    justify-content: stretch;
  }

  .topbar-actions > *,
  .form-actions > *,
  .dialog-actions > * {
    flex: 1;
  }

  .form-grid,
  .dialog-fields,
  .product-preview,
  .slow-open-accessories,
  .slow-copper-primary-grid,
  .slow-copper-secondary-grid,
  .slow-part-panel,
  .plate-options,
  .part-dimensions,
  .customer-image-layout {
    grid-template-columns: 1fr;
  }

  .product-spec-grid,
  .three-columns,
  .two-columns,
  .supplemental-fee-grid,
  .slow-copper-grid,
  .slow-copper-secondary-grid {
    grid-template-columns: 1fr;
  }

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

  .accessory-row {
    flex-direction: column;
  }

  .topbar h2 {
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
#quoteNotes .cost-warning {
  color: #c62828;
  font-weight: 700;
}
