:root {
  --bg: #f5f6f7;
  --panel: #ffffff;
  --panel-2: #f9fafb;
  --line: #d9dee5;
  --text: #1f2933;
  --muted: #687281;
  --accent: #0f766e;
  --accent-2: #164e63;
  --danger: #b42318;
  --shadow: 0 16px 40px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

button {
  cursor: pointer;
}

.app {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: #17212b;
  color: #ffffff;
}

.brand strong {
  display: block;
  font-size: 22px;
}

.brand span,
.sidebar-total span {
  color: rgba(255, 255, 255, 0.7);
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  text-align: left;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
}

.nav-tab.is-active,
.nav-tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-total {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

.sidebar-total strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.main {
  padding: 24px;
  overflow: auto;
}

.topbar,
.products-head,
.records-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.topbar h1,
.products-head h2 {
  margin: 0;
  font-size: 24px;
}

.topbar p,
.products-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

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

.topbar.is-record-editor {
  padding: 16px 18px;
  border: 1px solid #c8d8d4;
  border-left: 5px solid #0f766e;
  border-radius: 10px;
  background: linear-gradient(135deg, #f2faf8, #ffffff);
}

.topbar.is-record-editor h1 {
  color: #0f5f58;
}

.primary-btn,
.ghost-btn,
.small-btn {
  min-height: 38px;
  border-radius: 6px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.primary-btn {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.small-btn {
  min-height: 32px;
  padding: 0 10px;
}

.danger {
  color: var(--danger);
}

.muted {
  color: var(--muted);
}

.image-delete-btn {
  align-self: end;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
}

.quote-form,
.summary-panel,
.records-list,
.product-library,
.accessory-library {
  display: grid;
  gap: 14px;
}

.section-block,
.summary-panel,
.record-card,
.product-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-block {
  padding: 18px;
}

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

.section-title h2 {
  margin: 0;
  font-size: 18px;
}

.section-title span {
  color: var(--muted);
}

.quote-update-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.quote-update-tools [data-live-update-status]:not(:empty) {
  padding: 5px 9px;
  border-radius: 999px;
  color: #0f766e;
  background: #e9f7f3;
  font-size: 12px;
  font-weight: 700;
}

.live-update-btn {
  border-color: #91b9b0;
  color: #0f5f58;
  background: linear-gradient(135deg, #f4fbf9, #ffffff);
}

.live-update-btn:disabled {
  cursor: wait;
  opacity: 0.7;
}

.field-grid,
.line-main,
.line-extra,
.product-fields {
  display: grid;
  gap: 12px;
}

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

.line-main {
  grid-template-columns: 1.1fr 1.4fr repeat(10, minmax(76px, 1fr));
}

.internal-cost-field span,
.internal-cost-card span {
  color: #9a6700;
}

.internal-cost-field input,
.internal-cost-card {
  border-color: #ead9a8;
  background: #fffaf0;
}

.internal-cost-card strong {
  color: #805500;
}

.line-extra {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  align-items: end;
  margin-top: 12px;
}

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

.span-2 {
  grid-column: span 2;
}

.span-4 {
  grid-column: span 4;
}

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

textarea {
  resize: vertical;
}

input[readonly],
textarea[readonly] {
  color: #36544f;
  background: #f3f8f7;
}

.trade-term-notes-field textarea {
  min-height: 104px;
  line-height: 1.6;
}

.standard-order-notes-field textarea {
  min-height: 122px;
  line-height: 1.65;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.line-items {
  display: grid;
  gap: 12px;
}

.line-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.line-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 10px;
}

.drag-handle {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: #ffffff;
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

.line-item.is-dragging {
  opacity: 0.48;
  outline: 2px dashed var(--accent);
}

.image-preview,
.product-image,
.addon-preview {
  aspect-ratio: 1 / 1;
  min-height: 90px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #ffffff;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.proposal-upload-btn {
  position: relative;
  overflow: hidden;
}

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

.proposal-display-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--text);
  background: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.proposal-display-toggle input {
  width: 15px;
  height: 15px;
  margin: 0;
}

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

.proposal-image-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.proposal-image-card,
.proposal-image-empty {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbfa;
}

.proposal-image-card {
  min-width: 0;
  padding: 14px;
  display: grid;
  gap: 9px;
}

.proposal-image-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border: 1px solid #dce5e0;
  border-radius: 10px;
  background: #fff;
}

.proposal-image-card strong,
.proposal-image-card span {
  display: block;
  min-width: 0;
}

.proposal-image-card strong {
  color: var(--text);
  font-size: 13px;
}

.proposal-image-card span,
.proposal-image-empty {
  color: var(--muted);
  font-size: 12px;
}

.proposal-image-card > div:not(.proposal-image-actions-row) {
  min-width: 0;
}

.proposal-image-card > div:not(.proposal-image-actions-row) > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proposal-image-title-field {
  margin-top: 8px;
  display: grid;
  gap: 5px;
}

.proposal-image-title-field span {
  color: var(--muted);
  font-size: 11px;
}

.proposal-image-title-field input {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #d8e3de;
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  outline: none;
}

.proposal-image-title-field input:focus {
  border-color: #0f8a6a;
  box-shadow: 0 0 0 3px rgba(15, 138, 106, .1);
}

.proposal-image-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-width: 0;
}

.proposal-image-actions-row .small-btn {
  justify-content: center;
  text-align: center;
}

.proposal-image-empty {
  padding: 16px;
}

.pergola-addon-section {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.pergola-addon-title {
  margin-bottom: 10px;
  color: var(--text);
  font-weight: 800;
}

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

.pergola-addon-single {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 2fr auto;
  gap: 12px;
  align-items: end;
}

.pergola-addon-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.addon-preview {
  min-height: 110px;
}

.addon-preview-wide {
  aspect-ratio: 16 / 7;
  min-height: 120px;
}

.summary-panel {
  align-content: start;
  padding: 14px;
  position: sticky;
  top: 18px;
}

.summary-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.summary-card span {
  display: block;
  color: var(--muted);
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.summary-card.total {
  border-color: var(--accent);
}

.summary-table {
  display: grid;
  gap: 8px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.summary-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.records-toolbar input {
  max-width: 420px;
}

.record-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.record-card:hover,
.record-card:focus-visible {
  border-color: #88aaa3;
  box-shadow: 0 12px 28px rgba(15, 95, 88, 0.12);
  transform: translateY(-1px);
  outline: none;
}

.record-card h3 {
  margin: 0 0 8px;
}

.record-card p {
  margin: 0;
  color: var(--muted);
}

.order-profit-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(92px, auto));
  gap: 10px;
  align-items: stretch;
}

.order-profit-grid > div {
  min-width: 96px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

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

.order-profit-grid span {
  color: var(--muted);
  font-size: 12px;
}

.order-profit-grid strong {
  margin-top: 5px;
  color: var(--text);
  font-size: 15px;
}

.order-profit-grid .order-profit-total {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.order-profit-grid .order-profit-total span,
.order-profit-grid .order-profit-total strong {
  color: #fff;
}

.record-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.library-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.library-actions {
  display: grid;
  gap: 8px;
  align-content: start;
}

.library-image {
  aspect-ratio: 1 / 1;
  min-height: 120px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #ffffff;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.library-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.line-accessories-head,
.line-total-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.line-accessories {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.line-accessory-row {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.6fr 0.7fr 0.8fr 0.9fr auto;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.line-total-row strong {
  font-size: 18px;
}

.empty-row {
  padding: 10px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.weight-page {
  max-width: 1180px;
  margin: 0 auto;
}

.weight-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  margin-bottom: 18px;
  padding: 26px 28px;
  color: #ffffff;
  border-radius: 12px;
  background:
    radial-gradient(circle at 80% 20%, rgba(183, 146, 74, 0.24), transparent 32%),
    linear-gradient(135deg, #163d38, #17212b 72%);
  box-shadow: var(--shadow);
}

.weight-kicker {
  color: #d7b66f;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.weight-head h2 {
  margin: 8px 0 6px;
  font-size: 28px;
}

.weight-head p {
  max-width: 720px;
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.7;
}

.weight-badge {
  flex: 0 0 auto;
  min-width: 120px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  line-height: 1.55;
  text-align: right;
  background: rgba(255, 255, 255, 0.07);
}

.weight-badge strong {
  color: #ffffff;
  font-size: 15px;
}

.weight-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.82fr);
  gap: 18px;
}

.weight-calculator-card,
.weight-result-card,
.weight-reference-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.weight-calculator-card {
  padding: 22px;
}

.weight-card-title {
  display: flex;
  gap: 12px;
  align-items: center;
}

.weight-card-title > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  color: #ffffff;
  background: #0f766e;
  font-size: 12px;
  font-weight: 800;
}

.weight-card-title h3,
.weight-card-title p {
  margin: 0;
}

.weight-card-title h3 {
  font-size: 18px;
}

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

.weight-input-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.weight-input-grid label {
  display: grid;
  gap: 7px;
}

.weight-input-grid label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.weight-input-grid input,
.weight-input-grid select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #fbfcfc;
}

.weight-calculate-btn {
  width: 100%;
  margin-top: 16px;
}

.weight-roller-config {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #dfe5e5;
  border-radius: 8px;
  background: #f7faf9;
}

.weight-roller-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 14px;
  align-items: center;
}

.weight-roller-head strong,
.weight-roller-head span {
  display: block;
}

.weight-roller-head strong {
  color: #153f3a;
  font-size: 13px;
}

.weight-roller-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.weight-roller-head select,
.weight-roller-row input {
  width: 100%;
  min-height: 38px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.weight-roller-row input[readonly] {
  color: #0f766e;
  border-color: #b9d7d2;
  font-weight: 800;
  background: #edf7f5;
  cursor: not-allowed;
}

.weight-roller-custom {
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid #dfe5e5;
}

.weight-roller-row {
  display: grid;
  grid-template-columns: 70px repeat(3, minmax(80px, 1fr)) 76px;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.weight-roller-row > strong,
.weight-roller-row > b {
  font-size: 11px;
}

.weight-roller-row > b {
  color: #0f766e;
  text-align: right;
}

.weight-roller-labels {
  margin-top: 0;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.weight-roller-labels span:last-child {
  text-align: right;
}

.weight-roller-custom > p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.weight-method-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.weight-result-card {
  display: flex;
  flex-direction: column;
  padding: 22px;
  color: #ffffff;
  border-color: #153f3a;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), transparent 45%),
    #153f3a;
}

.weight-result-card.is-estimate {
  border-color: #9a7638;
  background:
    radial-gradient(circle at 92% 12%, rgba(215, 182, 111, 0.2), transparent 30%),
    #233834;
}

.weight-result-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.weight-result-top span {
  padding: 5px 9px;
  border-radius: 999px;
  color: #d9f2ed;
  background: rgba(255, 255, 255, 0.1);
  font-size: 10px;
  font-weight: 800;
}

.weight-result-top strong {
  color: #d7b66f;
  letter-spacing: 0.05em;
}

.weight-primary-result {
  margin: 28px 0 24px;
}

.weight-primary-result > span {
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
}

.weight-primary-result > strong {
  display: flex;
  gap: 9px;
  align-items: baseline;
  margin-top: 5px;
}

.weight-primary-result b {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 58px;
  line-height: 1;
  font-weight: 700;
}

.weight-primary-result small {
  color: #d7b66f;
  font-size: 17px;
}

.weight-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: auto;
  background: rgba(255, 255, 255, 0.13);
}

.weight-result-grid > div {
  min-height: 74px;
  padding: 12px;
  background: #153f3a;
}

.weight-result-card.is-estimate .weight-result-grid > div {
  background: #233834;
}

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

.weight-result-grid span {
  color: rgba(255, 255, 255, 0.58);
  font-size: 10px;
}

.weight-result-grid strong {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
}

.weight-reference-card {
  margin-top: 18px;
  padding: 22px;
}

.weight-reference-groups {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 16px;
  margin-top: 18px;
}

.weight-reference-group {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.weight-reference-group.is-active {
  border-color: #0f766e;
  box-shadow: inset 0 3px 0 #0f766e;
}

.weight-reference-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 11px;
}

.weight-reference-title span {
  color: var(--muted);
  font-size: 11px;
}

.weight-standard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.weight-reference-group:last-child .weight-standard-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.weight-standard-grid button {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #e1e6e8;
  border-radius: 6px;
  text-align: left;
  color: var(--text);
  background: #ffffff;
}

.weight-standard-grid button:hover {
  border-color: #0f766e;
  transform: translateY(-1px);
}

.weight-standard-grid span {
  color: var(--muted);
  font-size: 11px;
}

.weight-standard-grid small {
  color: #8a743f;
  font-size: 9px;
}

.weight-standard-grid strong {
  color: #153f3a;
  font-size: 14px;
}

.print-report {
  display: none;
}

.print-shell {
  color: #17212b;
  background: #ffffff;
}

.print-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 28px;
  padding: 28px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.95), rgba(23, 33, 43, 0.98)),
    #17212b;
  border-radius: 18px;
}

.print-brand-mark {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.print-brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 128px;
  height: 72px;
  margin-bottom: 18px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
}

.print-brand-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.print-kicker {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  letter-spacing: 0.18em;
}

.print-hero h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -0.04em;
}

.print-subtitle {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.78);
}

.print-stamp {
  align-self: end;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
}

.print-stamp span,
.print-stamp small {
  display: block;
  color: rgba(255, 255, 255, 0.72);
}

.print-stamp strong {
  display: block;
  margin: 8px 0;
  font-size: 28px;
}

.print-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.print-info-card,
.print-section,
.print-total-card {
  border: 1px solid #d8dee6;
  border-radius: 16px;
  background: #ffffff;
}

.print-info-card {
  padding: 16px;
}

.print-info-card h3 {
  margin: 0 0 12px;
  color: #0f766e;
  font-size: 14px;
}

.print-info-card div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid #edf0f3;
}

.print-info-card span,
.print-table th,
.print-term span,
.print-total-row span,
.print-grand-total span {
  color: #687281;
  font-size: 12px;
  font-weight: 700;
}

.print-info-card strong {
  font-size: 13px;
  font-weight: 700;
}

.print-section {
  margin-top: 16px;
  overflow: hidden;
}

.print-section-title {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid #d8dee6;
  background: #f8fafb;
}

.print-section-title span {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  color: #ffffff;
  background: #0f766e;
  font-size: 12px;
  font-weight: 800;
}

.print-section-title h2 {
  margin: 0;
  font-size: 18px;
}

.print-section-title small {
  display: block;
  margin-top: 2px;
  color: #8a9690;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.print-proposal-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 18px;
}

.print-proposal-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.print-proposal-visual {
  margin: 0;
  min-height: 0;
  padding: 14px;
  border: 1px solid #d8dee6;
  border-radius: 16px;
  background:
    radial-gradient(circle at 18% 15%, rgba(15, 118, 110, 0.12), transparent 34%),
    linear-gradient(135deg, #f8faf9, #ffffff);
}

.print-proposal-visual img,
.print-proposal-placeholder {
  display: block;
  width: 100%;
  height: 230px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.print-proposal-placeholder {
  display: grid;
  place-items: center;
  color: #0f766e;
  font-size: 44px;
  font-weight: 900;
  letter-spacing: -0.08em;
}

.print-proposal-visual figcaption {
  margin-top: 10px;
  color: #687281;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.print-proposal-content {
  align-self: stretch;
  padding: 0;
}

.print-proposal-label {
  margin: 0 0 8px;
  color: #b08a43;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.print-proposal-content h3 {
  margin: 0 0 14px;
  color: #153f3a;
  font-size: 24px;
  line-height: 1.2;
}

.print-proposal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.print-proposal-grid div,
.print-proposal-note {
  padding: 12px;
  border: 1px solid #edf0f3;
  border-radius: 12px;
  background: #fbfdfc;
}

.print-proposal-grid div:last-child {
  grid-column: 1 / -1;
}

.print-proposal-grid span,
.print-proposal-note span {
  display: block;
  margin-bottom: 6px;
  color: #687281;
  font-size: 11px;
  font-weight: 800;
}

.print-proposal-grid strong {
  color: #17212b;
  font-size: 13px;
  line-height: 1.55;
}

.print-proposal-note {
  margin-top: 10px;
}

.print-proposal-note p {
  margin: 0;
  color: #2d3a36;
  font-size: 12px;
  line-height: 1.7;
}

.print-proposal-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.print-proposal-gallery figure {
  margin: 0;
  padding: 6px;
  border: 1px solid #edf0f3;
  border-radius: 10px;
  background: #ffffff;
}

.print-proposal-gallery img {
  display: block;
  width: 100%;
  height: 78px;
  object-fit: contain;
}

.print-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.print-table th:first-child,
.print-table td:first-child {
  width: 28%;
}

.print-table th:nth-child(2),
.print-table td:nth-child(2) { width: 22%; }
.print-table th:nth-child(3),
.print-table td:nth-child(3) { width: 8%; }
.print-table th:nth-child(4),
.print-table td:nth-child(4) { width: 12%; }
.print-table th:nth-child(5),
.print-table td:nth-child(5) { width: 14%; }
.print-table th:nth-child(6),
.print-table td:nth-child(6) { width: 16%; }

.print-table th,
.print-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf0f3;
  text-align: left;
  vertical-align: top;
}

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

.print-table td small {
  display: block;
  margin-top: 4px;
  color: #687281;
}

.print-item-cell {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.print-item-cell img,
.print-item-placeholder {
  width: 72px;
  height: 72px;
  border: 1px solid #d8dee6;
  border-radius: 12px;
  background: #f8fafb;
}

.print-item-cell img {
  object-fit: contain;
}

.print-item-cell .print-line-note {
  color: #0f766e;
  font-style: italic;
}

.print-item-placeholder {
  display: grid;
  place-items: center;
  color: #0f766e;
  font-weight: 800;
}

.print-main-row td {
  background: #ffffff;
}

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

.print-terms {
  margin-top: 0;
}

.print-terms-compact {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid #edf0f3;
}

.print-terms-compact .print-term {
  border-right: 1px solid #edf0f3;
  border-bottom: 0;
}

.print-terms-compact .print-term:last-child {
  border-right: 0;
}

.print-term {
  padding: 12px 18px;
  border-bottom: 1px solid #edf0f3;
}

.print-term:last-child {
  border-bottom: 0;
}

.print-term p {
  margin: 5px 0 0;
  line-height: 1.65;
  white-space: normal;
}

.print-note-list {
  margin-top: 0;
}

.print-note-list .print-note-line {
  margin: 0;
}

.print-total-card {
  align-self: start;
  padding: 18px;
  background:
    linear-gradient(180deg, #ffffff, #f8fafb);
}

.print-total-card-wide {
  display: block;
  padding: 0;
  overflow: hidden;
  border-color: #cfd8d6;
  box-shadow: 0 10px 28px rgba(23, 33, 43, 0.08);
}

.print-summary-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  min-height: 58px;
  padding: 10px 18px;
  border-bottom: 1px solid #dce3e1;
  background:
    linear-gradient(90deg, #f4f8f7, #ffffff 70%);
}

.print-summary-header small,
.print-summary-header h3 {
  display: block;
  margin: 0;
}

.print-summary-header > div > small {
  color: #b08a43;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.print-summary-header h3 {
  margin-top: 3px;
  color: #153f3a;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
}

.print-summary-meta {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 9px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid #d9e1df;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.print-summary-meta span {
  color: #73807d;
  font-size: 8px;
  font-weight: 700;
}

.print-summary-meta strong {
  color: #153f3a;
  font-size: 12px;
}

.print-summary-meta em {
  grid-column: 1 / -1;
  margin-top: 2px;
  color: #87918f;
  font-size: 7px;
  font-style: normal;
  text-align: right;
}

.print-summary-body {
  display: grid;
  grid-template-columns: 1fr 1.35fr 0.85fr 1.45fr;
  align-items: stretch;
}

.print-summary-metric {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 90px;
  padding: 14px 18px;
  border-right: 1px solid #e2e7eb;
  background: linear-gradient(180deg, #ffffff, #fbfcfc);
}

.print-summary-metric span {
  display: flex;
  gap: 7px;
  align-items: center;
  color: #687281;
  font-size: 10px;
  font-weight: 700;
  min-height: 19px;
}

.print-summary-metric span i {
  display: inline-grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  color: #ffffff;
  background: #0f766e;
  font-size: 7px;
  font-style: normal;
}

.print-summary-metric strong {
  display: block;
  margin-top: 7px;
  color: #17212b;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 19px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.print-summary-metric small {
  display: block;
  margin-top: 5px;
  color: #7a8591;
  font-size: 9px;
  line-height: 1.4;
}

.print-total-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f3;
}

.print-total-row-heading {
  padding-bottom: 6px;
}

.print-fee-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 5px 0 5px 12px;
  border-bottom: 1px dashed #e3e8ee;
}

.print-fee-detail-row span {
  color: #687281;
  font-size: 11px;
}

.print-fee-detail-row strong {
  font-size: 12px;
}

.print-grand-total {
  margin-top: 14px;
  padding: 18px;
  border-radius: 14px;
  color: #ffffff;
  background: #17212b;
}

.print-total-card-wide .print-grand-total {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 90px;
  margin: 0;
  border-radius: 0;
  padding: 14px 22px;
  border-left: 4px solid #b7924a;
  background:
    radial-gradient(circle at 90% 15%, rgba(183, 146, 74, 0.2), transparent 34%),
    linear-gradient(135deg, #153f3a, #17212b);
}

.print-total-card-wide .print-grand-total strong {
  margin: 7px 0 4px;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 27px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.print-total-card-wide .print-grand-total > span {
  display: flex;
  align-items: center;
  min-height: 19px;
}

.print-grand-total span,
.print-grand-total small {
  color: rgba(255, 255, 255, 0.7);
}

.print-grand-total strong {
  display: block;
  margin: 8px 0;
  font-size: 28px;
}

.print-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid #d8dee6;
  color: #687281;
  font-size: 12px;
}

.pi-export-btn {
  border-color: #b7924a;
  color: #765b25;
  background: #fffaf0;
}

.pi-fields-block {
  border-top: 3px solid #b7924a;
}

.pi-stamp-settings {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(360px, 2fr) 150px;
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid #d9dfdf;
  border-radius: 14px;
  background: linear-gradient(135deg, #fffdf8, #f7faf9);
}

.pi-payment-qr-settings {
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) minmax(0, 2.2fr);
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid #d9dfdf;
  border-radius: 14px;
  background: linear-gradient(135deg, #f7fbf9, #ffffff);
}

.pi-stamp-copy strong,
.pi-stamp-copy span {
  display: block;
}

.pi-stamp-copy strong {
  color: #153f3a;
  font-size: 15px;
}

.pi-stamp-copy span {
  margin-top: 6px;
  color: #687281;
  font-size: 12px;
  line-height: 1.5;
}

.pi-stamp-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  align-items: center;
}

.pi-payment-qr-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.pi-payment-qr-card {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  border: 1px solid #dce5e2;
  border-radius: 12px;
  background: #ffffff;
}

.pi-payment-qr-card strong {
  display: block;
  margin-bottom: 8px;
  color: #153f3a;
}

.pi-payment-qr-card .pi-stamp-upload {
  width: 100%;
  min-height: 36px;
  margin-bottom: 8px;
}

.pi-payment-qr-remove {
  width: 100%;
  min-height: 34px;
}

.pi-stamp-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  color: #ffffff;
  background: #153f3a;
  cursor: pointer;
}

.pi-stamp-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.pi-stamp-toggle {
  display: flex;
  grid-template-columns: none;
  gap: 8px;
  align-items: center;
}

.pi-stamp-toggle input {
  width: 18px;
  height: 18px;
}

.pi-stamp-size {
  grid-column: span 2;
}

.pi-stamp-size > span {
  display: flex;
  justify-content: space-between;
}

.pi-stamp-preview {
  display: grid;
  place-items: center;
  width: 150px;
  height: 120px;
  overflow: hidden;
  border: 1px dashed #b9c3c6;
  border-radius: 12px;
  color: #7b878b;
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, #f0f2f2 25%, transparent 25%),
    linear-gradient(-45deg, #f0f2f2 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f0f2f2 75%),
    linear-gradient(-45deg, transparent 75%, #f0f2f2 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.pi-payment-qr-preview {
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  overflow: hidden;
  border: 1px dashed #b9c3c6;
  border-radius: 12px;
  color: #7b878b;
  background: #ffffff;
}

.pi-payment-qr-preview span {
  max-width: 70px;
  text-align: center;
  font-size: 12px;
  line-height: 1.35;
}

.pi-payment-qr-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pi-stamp-preview img {
  width: 110px;
  height: 110px;
  object-fit: contain;
}

.pi-shell {
  color: #162329;
  background: #ffffff;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

.pi-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 28px;
  align-items: start;
  padding: 4px 0 22px;
  border-bottom: 4px solid #153f3a;
}

.pi-brand {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.pi-brand img {
  width: 112px;
  height: 68px;
  object-fit: contain;
}

.pi-brand strong,
.pi-brand span {
  display: block;
}

.pi-brand strong {
  color: #153f3a;
  font-size: 17px;
  letter-spacing: 0.04em;
}

.pi-brand span {
  margin-top: 7px;
  color: #65747b;
  font-size: 11px;
  line-height: 1.45;
}

.pi-heading {
  text-align: right;
}

.pi-heading p {
  min-height: 13px;
  margin: 0;
  color: #b7924a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.pi-heading h1 {
  margin: 4px 0 12px;
  color: #153f3a;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  letter-spacing: 0.03em;
}

.pi-heading div {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid #d9dfdf;
  border-radius: 4px;
  background: #f7f9f8;
}

.pi-heading div span {
  color: #6c787d;
  font-size: 10px;
  text-transform: uppercase;
}

.pi-heading div strong {
  color: #153f3a;
  font-size: 12px;
}

.pi-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.pi-party {
  min-height: 104px;
  padding: 14px 16px;
  border: 1px solid #d9dfdf;
  border-top: 3px solid #b7924a;
  background: #ffffff;
}

.pi-party h2,
.pi-panel h2 {
  margin: 0 0 9px;
  color: #153f3a;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.pi-party > strong {
  display: block;
  font-size: 13px;
}

.pi-party p,
.pi-party small {
  display: block;
  margin: 5px 0 0;
  color: #596970;
  font-size: 10px;
  line-height: 1.45;
}

.pi-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
  border: 1px solid #d9dfdf;
  border-right: 0;
  border-bottom: 0;
}

.pi-meta-grid > div {
  min-height: 50px;
  padding: 8px 10px;
  border-right: 1px solid #d9dfdf;
  border-bottom: 1px solid #d9dfdf;
}

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

.pi-meta-grid span {
  color: #78858a;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.pi-meta-grid strong {
  margin-top: 5px;
  font-size: 11px;
}

.pi-table {
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
  table-layout: fixed;
}

.pi-table th {
  padding: 9px 8px;
  color: #ffffff;
  background: #153f3a;
  font-size: 9px;
  letter-spacing: 0.03em;
  text-align: left;
}

.pi-table th small {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 8px;
}

.pi-table th:nth-child(1),
.pi-table td:nth-child(1) { width: 4%; text-align: center; }
.pi-table th:nth-child(2),
.pi-table td:nth-child(2) { width: 28%; }
.pi-table th:nth-child(3),
.pi-table td:nth-child(3) { width: 20%; }
.pi-table th:nth-child(4),
.pi-table td:nth-child(4) { width: 8%; }
.pi-table th:nth-child(5),
.pi-table td:nth-child(5) { width: 11%; }
.pi-table th:nth-child(6),
.pi-table td:nth-child(6),
.pi-table th:nth-child(7),
.pi-table td:nth-child(7) { width: 14.5%; text-align: right; }

.pi-table td {
  padding: 10px 8px;
  border-right: 1px solid #e1e6e6;
  border-bottom: 1px solid #d9dfdf;
  border-left: 1px solid #e1e6e6;
  font-size: 10px;
  vertical-align: top;
}

.pi-table td small {
  color: #6b787e;
  font-size: 9px;
}

.pi-product {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: center;
}

.pi-product img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border: 1px solid #e1e6e6;
  background: #ffffff;
}

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

.pi-product small {
  margin-top: 4px;
  line-height: 1.35;
}

.pi-charge-row td {
  color: #45555b;
  background: #fafbfa;
}

.pi-table tfoot td {
  padding: 12px 9px;
  color: #ffffff;
  background: #153f3a;
  border-color: #153f3a;
  vertical-align: middle;
}

.pi-table tfoot td:nth-last-child(2),
.pi-table tfoot td:last-child {
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.pi-amount-words span,
.pi-amount-words strong {
  display: block;
}

.pi-amount-words span {
  color: rgba(255, 255, 255, 0.65);
  font-size: 8px;
}

.pi-amount-words strong {
  margin-top: 4px;
  font-size: 9px;
  letter-spacing: 0.02em;
}

.pi-lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 12px;
  margin-top: 16px;
}

.pi-panel {
  border: 1px solid #d9dfdf;
}

.pi-panel h2 {
  padding: 10px 12px;
  margin: 0;
  color: #ffffff;
  background: #153f3a;
}

.pi-term,
.pi-bank-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 11px;
  border-bottom: 1px solid #e6eaea;
}

.pi-payment-qr-block {
  padding: 9px 11px 11px;
  border-bottom: 1px solid #e6eaea;
}

.pi-payment-qr-block > span {
  display: block;
  margin-bottom: 8px;
  color: #718086;
  font-size: 9px;
  font-weight: 700;
}

.pi-payment-qr-export-list {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.pi-payment-qr-export-list figure {
  width: 82px;
  margin: 0;
  text-align: center;
}

.pi-payment-qr-export-list img {
  display: block;
  width: 82px;
  height: 82px;
  object-fit: contain;
  border: 1px solid #d9dfdf;
  border-radius: 8px;
  background: #fff;
}

.pi-payment-qr-export-list figcaption {
  margin-top: 4px;
  color: #153f3a;
  font-size: 9px;
  font-weight: 700;
}

.pi-term:last-child,
.pi-bank-row:last-child {
  border-bottom: 0;
}

.pi-term span,
.pi-bank-row span {
  color: #718086;
  font-size: 9px;
  font-weight: 700;
}

.pi-term p,
.pi-bank-row strong {
  margin: 0;
  font-size: 9px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.pi-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  margin-top: 24px;
}

.pi-signatures > div {
  position: relative;
  min-height: 74px;
  padding: 0 12px;
}

.pi-stamp-image {
  position: absolute;
  z-index: 2;
  top: -16px;
  right: 22px;
  height: auto;
  max-height: 112px;
  object-fit: contain;
  opacity: 0.9;
  transform: rotate(-5deg);
}

.pi-signatures span,
.pi-signatures strong {
  display: block;
  font-size: 9px;
}

.pi-signatures span {
  color: #718086;
}

.pi-signatures i {
  display: block;
  height: 40px;
  border-bottom: 1px solid #9ba6aa;
}

.pi-signatures strong {
  margin-top: 6px;
  color: #153f3a;
}

.pi-footer {
  margin-top: 18px;
  padding-top: 9px;
  border-top: 1px solid #d9dfdf;
  color: #7a878c;
  font-size: 8px;
  text-align: center;
}

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

  * {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body {
    background: #ffffff;
  }

  .app {
    display: none !important;
  }

  .print-report {
    display: block;
  }

  .sidebar,
  .topbar,
  .nav-tabs,
  .records-toolbar,
  .products-head,
  .product-library,
  .accessory-library,
  .summary-panel,
  .section-title button,
  [data-remove-line],
  input[type="file"] {
    display: none !important;
  }

  .print-shell {
    width: 100%;
    font-size: 11px;
  }

  .print-table th,
  .print-table td {
    padding: 9px 11px;
  }

  .print-item-cell {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 10px;
  }

  .print-item-cell img,
  .print-item-placeholder {
    width: 64px;
    height: 64px;
  }

  .pi-shell {
    width: 100%;
    font-size: 10px;
  }

  .pi-header,
  .pi-parties,
  .pi-meta-grid,
  .pi-table thead,
  .pi-table tfoot,
  .pi-lower-grid,
  .pi-signatures {
    break-inside: avoid;
  }

  .pi-table thead {
    display: table-header-group;
  }

  .pi-table tfoot {
    display: table-row-group;
  }

  .pi-table tbody tr {
    break-inside: avoid;
  }

  .pi-header {
    padding-bottom: 14px;
  }

  .pi-brand img {
    height: 58px;
  }

  .pi-heading h1 {
    margin-bottom: 8px;
    font-size: 27px;
  }

  .pi-parties {
    margin-top: 12px;
  }

  .pi-party {
    min-height: 86px;
    padding: 10px 13px;
  }

  .pi-meta-grid {
    margin-top: 9px;
  }

  .pi-meta-grid > div {
    min-height: 42px;
    padding: 6px 9px;
  }

  .pi-table {
    margin-top: 12px;
  }

  .pi-table th {
    padding: 7px 7px;
  }

  .pi-table td {
    padding: 7px;
  }

  .pi-product img {
    width: 40px;
    height: 40px;
  }

  .pi-lower-grid {
    margin-top: 12px;
  }

  .pi-panel h2 {
    padding: 8px 10px;
  }

  .pi-term,
  .pi-bank-row {
    padding: 5px 9px;
  }

  .pi-signatures {
    gap: 28px;
    margin-top: 6px;
  }

  .pi-signatures > div {
    display: grid;
    grid-template-columns: auto minmax(50px, 1fr) auto;
    gap: 7px;
    align-items: end;
    min-height: 20px;
    padding: 0 8px;
  }

  .pi-signatures i {
    height: 0;
  }

  .pi-signatures.has-stamp > div {
    display: block;
    min-height: 82px;
  }

  .pi-signatures.has-stamp i {
    height: 48px;
  }

  .pi-signatures.has-stamp .pi-stamp-image {
    top: -12px;
    right: 28px;
  }

  .pi-footer {
    margin-top: 5px;
    padding-top: 4px;
  }

  .print-hero,
  .print-info-card,
  .print-proposal,
  .print-total-card {
    break-inside: avoid;
    box-shadow: none;
  }

  .print-section {
    break-inside: auto;
    page-break-inside: auto;
    overflow: visible;
    box-shadow: none;
  }

  .print-table {
    break-inside: auto;
    page-break-inside: auto;
  }

  .print-table thead {
    display: table-header-group;
  }

  .print-hero {
    border-radius: 14px;
    padding: 22px 24px;
  }

  .print-brand-logo {
    width: 110px;
    height: 62px;
    margin-bottom: 12px;
  }

  .print-hero h1 {
    font-size: 30px;
  }

  .print-meta-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
  }

  .print-info-card {
    padding: 12px 14px;
  }

  .print-info-card div {
    padding: 6px 0;
  }

  .print-section {
    margin-top: 12px;
  }

  .print-proposal-body {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }

  .print-proposal-visual {
    padding: 12px;
  }

  .print-proposal-visual img,
  .print-proposal-placeholder {
    height: 185px;
  }

  .print-bottom-grid {
    display: block;
    grid-template-columns: 1fr;
  }

  .print-terms {
    display: block;
  }

  .print-table tr {
    break-inside: avoid;
  }

  .print-section-title {
    break-after: avoid-page;
    page-break-after: avoid;
  }

  .print-term {
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  .print-notes-term {
    break-inside: auto;
    page-break-inside: auto;
  }

  .print-terms-compact,
  .print-note-lead {
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  .print-note-line {
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  .print-term p {
    orphans: 3;
    widows: 3;
  }
}

@media (max-width: 1180px) {
  .app,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .summary-panel {
    position: static;
  }

  .weight-layout,
  .weight-reference-groups {
    grid-template-columns: 1fr;
  }

  .line-main,
  .line-extra,
  .field-grid.four,
  .library-card,
  .line-accessory-row,
  .pergola-addon-single,
  .pergola-addon-grid {
    grid-template-columns: 1fr 1fr;
  }

  .pi-stamp-settings {
    grid-template-columns: 1fr 1.5fr 130px;
  }

  .pi-payment-qr-settings {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 14px;
  }

  .topbar,
  .products-head,
  .records-toolbar,
  .record-card {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .field-grid.four,
  .line-main,
  .line-extra,
  .product-fields,
  .library-fields,
  .library-card,
  .line-accessory-row,
  .pergola-addon-single,
  .pergola-addon-grid {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-4 {
    grid-column: auto;
  }

  .pi-stamp-settings {
    grid-template-columns: 1fr;
  }

  .pi-payment-qr-settings,
  .pi-payment-qr-list,
  .pi-payment-qr-card {
    grid-template-columns: 1fr;
  }

  .pi-payment-qr-preview {
    width: 100%;
  }

  .pi-stamp-preview {
    width: 100%;
  }

  .weight-head {
    align-items: stretch;
    flex-direction: column;
    padding: 22px;
  }

  .weight-badge {
    text-align: left;
  }

  .weight-input-grid,
  .weight-result-grid,
  .weight-standard-grid,
  .weight-reference-group:last-child .weight-standard-grid {
    grid-template-columns: 1fr;
  }

  .weight-roller-head {
    grid-template-columns: 1fr;
  }

  .weight-roller-row {
    grid-template-columns: 62px repeat(3, minmax(62px, 1fr)) 68px;
  }
}

/* Supplier / dealer platform */
.platform-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at 12% 18%, rgba(207, 174, 99, .2), transparent 32%),
    linear-gradient(135deg, #101d1a 0%, #19352e 52%, #efe9dc 52%, #f8f5ed 100%);
}

.platform-login[hidden], .platform-only[hidden], .platform-account[hidden] { display: none !important; }

.login-card {
  width: min(440px, 100%);
  padding: 42px;
  border-radius: 26px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 28px 80px rgba(7, 20, 17, .28);
}

.login-brand {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #fff;
  background: #163d34;
  font: 800 25px/1 Georgia, serif;
}

.eyebrow { margin: 20px 0 7px; color: #a27326; font-size: 12px; font-weight: 800; letter-spacing: .16em; }
.login-card h1 { margin: 0 0 10px; color: #14221f; font-family: Georgia, "Times New Roman", serif; font-size: 30px; }
.login-card > p:not(.eyebrow) { color: #66736f; line-height: 1.7; }
.login-card label, .platform-card label { display: grid; gap: 7px; margin-top: 16px; }
.login-card label span, .platform-card label span { color: #52645f; font-size: 13px; font-weight: 700; }
.login-submit { width: 100%; margin-top: 22px; }
.login-error { min-height: 20px; margin-top: 12px; color: #b42318; font-size: 13px; }

.platform-account {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 14px;
  display: grid;
  gap: 3px;
  color: #fff;
}
.platform-account span, .platform-account small { color: #aebfba; }
.platform-account button { margin-top: 9px; padding: 0; border: 0; background: none; color: #e3bd75; text-align: left; cursor: pointer; }
.nav-tab b { min-width: 20px; padding: 2px 6px; border-radius: 999px; float: right; color: #173a32; background: #f2c96d; font-size: 11px; }

.platform-view { padding-bottom: 50px; }
.platform-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.platform-page-head h2 { margin: 0 0 7px; font: 700 31px/1.1 Georgia, "Times New Roman", serif; color: #17342e; }
.platform-page-head p:not(.eyebrow) { margin: 0; color: #6b7975; }
.platform-grid { display: grid; gap: 18px; margin-bottom: 18px; }
.platform-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.platform-card { padding: 22px; border: 1px solid #dbe4e1; border-radius: 18px; background: #fff; box-shadow: 0 10px 30px rgba(25, 55, 47, .05); }
.platform-card h3 { margin: 0 0 12px; color: #1b3831; }
.platform-card .primary-btn { margin-top: 18px; }
.table-card { padding: 0; overflow: hidden; }
.table-card > h3 { padding: 20px 22px 0; }
.platform-table-wrap { overflow-x: auto; }
.platform-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.platform-table th, .platform-table td { padding: 13px 16px; border-bottom: 1px solid #e8eeec; text-align: left; vertical-align: middle; }
.platform-table th { color: #61716c; background: #f5f8f7; font-size: 12px; letter-spacing: .03em; }
.platform-table td { color: #263a35; font-size: 14px; }
.platform-table input { min-width: 105px; padding: 9px 10px; }
.status-pill { display: inline-flex; padding: 4px 9px; border-radius: 999px; background: #edf2f0; color: #42534e; font-size: 12px; font-weight: 700; }
.status-pill.pending_approval, .status-pill.pending { color: #84520c; background: #fff2d6; }
.status-pill.approved { color: #08735c; background: #dff7ef; }
.status-pill.accepted { color: #075d49; background: #cdf3e3; }
.status-pill.rejected { color: #a3302b; background: #fee8e7; }
.approval-list { display: grid; gap: 14px; }
.approval-card { display: grid; grid-template-columns: 1fr auto; gap: 20px; padding: 21px 23px; border: 1px solid #dce5e2; border-radius: 18px; background: #fff; }
.approval-card h3 { margin: 0 0 8px; color: #19372f; }
.approval-card p { margin: 4px 0; color: #687671; }
.approval-actions { display: flex; gap: 8px; align-items: center; }
.record-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }

@media (max-width: 900px) {
  .platform-grid.two { grid-template-columns: 1fr; }
  .platform-page-head, .approval-card { align-items: stretch; flex-direction: column; }
  .approval-card { grid-template-columns: 1fr; }
  .order-profit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-profit-grid .order-profit-total { grid-column: 1 / -1; }
}
