﻿:root,
html[data-theme="copper"] {
  --bg-page: #f6f4ef;
  --bg-card: #ffffff;
  --bg-card-soft: #fcfbf8;
  --bg-subtle: #f1ede6;
  --text-primary: #1f2933;
  --text-secondary: #5b6875;
  --text-muted: #7b8794;
  --border-soft: #d9e0e6;
  --border-strong: #c8d0d7;
  --accent: #b77945;
  --accent-strong: #a86d3f;
  --accent-soft: #f1e5d9;
  --accent-soft-strong: #ead7c3;
  --danger-soft: #f8efe8;
  --danger-text: #875730;
  --success-soft: #eef4ef;
  --success-text: #4d6856;
  --shadow-card: 0 10px 24px rgba(31, 41, 51, 0.06);
  --shadow-soft: 0 4px 10px rgba(31, 41, 51, 0.04);
  --shadow-focus: 0 0 0 4px rgba(183, 121, 69, 0.14);
  --radius-card: 18px;
  --radius-section: 15px;
  --radius-control: 11px;
  --radius-pill: 999px;
  --transition: 160ms ease;
  font-family: "Microsoft YaHei", "PingFang SC", "Source Han Sans SC", sans-serif;
}

html[data-theme="sage"] {
  --accent: #6f8b7a;
  --accent-strong: #5f7d6e;
  --accent-soft: #e4ece7;
  --accent-soft-strong: #d7e2db;
  --shadow-focus: 0 0 0 4px rgba(111, 139, 122, 0.14);
}

html[data-theme="teal"] {
  --accent: #4f6b6a;
  --accent-strong: #5d7473;
  --accent-soft: #e3ebea;
  --accent-soft-strong: #d8e2e1;
  --shadow-focus: 0 0 0 4px rgba(79, 107, 106, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--text-primary);
  background: var(--bg-page);
}

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

button {
  cursor: pointer;
}

input::placeholder,
textarea::placeholder {
  color: #94a0ab;
}

.app-shell {
  max-width: 1460px;
  margin: 0 auto;
  padding: 22px;
}

.app-header {
  position: sticky;
  top: 12px;
  z-index: 30;
  margin-bottom: 18px;
  padding: 18px 20px;
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-card);
}

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

.brand-block h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1.22;
  letter-spacing: 0.01em;
}

.brand-block p {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 0.94rem;
  line-height: 1.65;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.toolbar-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 2px 0 0;
}

.toolbar-field span {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  background: var(--bg-card-soft);
}

.toolbar-group label {
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.toolbar select,
.field-control {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}

.toolbar select {
  min-width: 148px;
  padding: 8px 14px;
  font-size: 0.97rem;
  font-weight: 600;
}

.field-control:hover,
.toolbar select:hover {
  border-color: var(--border-strong);
}

.field-control:focus,
.toolbar select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
}

.field-control[readonly] {
  background: #f8f7f4;
  color: var(--text-secondary);
}

.field-control--multiline {
  min-height: 86px;
  resize: vertical;
  line-height: 1.6;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: background-color var(--transition), border-color var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.toolbar .button {
  min-height: 44px;
  padding: 0 18px;
  font-weight: 600;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.button:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

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

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

.button--secondary {
  border-color: var(--border-soft);
  background: var(--bg-card);
  color: var(--text-primary);
}

.button--ghost {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.button--accent {
  border-color: rgba(183, 121, 69, 0.26);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.button--danger {
  border-color: rgba(135, 87, 48, 0.18);
  background: var(--danger-soft);
  color: var(--danger-text);
}

.button--small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.86rem;
}

.tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tab-button {
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: #f1efe9;
  color: var(--text-secondary);
  transition: background-color var(--transition), border-color var(--transition), color var(--transition);
}

.tab-button.is-active {
  border-color: rgba(183, 121, 69, 0.24);
  background: var(--bg-card);
  color: var(--accent-strong);
  box-shadow: var(--shadow-soft);
}

.app-main,
.stack {
  display: grid;
  gap: 18px;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.82fr);
  gap: 18px;
  align-items: start;
}

.panel-card {
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.history-filter-card {
  overflow: visible;
}

.panel-card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 0;
}

.panel-card__header h2,
.panel-card__header h3 {
  margin: 0;
  font-size: 1.08rem;
}

.panel-card__header p,
.card-subtitle {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.65;
}

.panel-card__body {
  padding: 18px 22px 22px;
}

.panel-card__body--preview {
  padding-top: 14px;
}

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

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

.form-grid--history {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.form-grid--history > .field {
  grid-column: span 3;
}

.field--history-reset {
  align-content: end;
}

.field-label--placeholder {
  visibility: hidden;
}

.history-reset-button {
  justify-self: end;
  width: auto;
  min-width: 128px;
  padding-inline: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

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

.field label,
.field .field-label {
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 600;
}

.field-hint {
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.field-control--multiple {
  min-height: 104px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.multi-select {
  position: relative;
}

.multi-select__summary {
  list-style: none;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.multi-select__summary::-webkit-details-marker {
  display: none;
}

.multi-select__summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.multi-select[open] .multi-select__summary::after {
  content: "▴";
}

.multi-select__panel {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: var(--bg-card);
  box-shadow: var(--shadow-soft);
}

.multi-select__option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 6px;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.86rem;
  line-height: 1.4;
}

.multi-select__option:hover {
  background: #f8f7f4;
}

.multi-select__option input {
  margin-top: 2px;
}

.inline-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.checkbox-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: #fff;
  font-size: 0.86rem;
  color: var(--text-primary);
}

.checkbox-chip input {
  margin: 0;
}

.inline-badges--compact {
  margin-top: -2px;
}

.badge,
.status-tag,
.summary-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(183, 121, 69, 0.16);
  border-radius: var(--radius-pill);
  background: #fbf8f3;
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1;
  white-space: nowrap;
}

.badge strong {
  color: var(--text-primary);
}

.badge--warning,
.status-tag--warning {
  border-color: rgba(135, 87, 48, 0.18);
  background: var(--danger-soft);
  color: var(--danger-text);
}

.module-block {
  display: grid;
  gap: 16px;
}

.module-block + .module-block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #ebe8e1;
}

.module-block--primary {
  padding: 18px;
  border: 1px solid #ebe6de;
  border-radius: var(--radius-card);
  background: linear-gradient(180deg, #fffdf9 0%, #ffffff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.module-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.module-header__main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.module-copy {
  display: grid;
  gap: 8px;
}

.module-copy h3 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.3;
}

.module-copy p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.89rem;
  line-height: 1.68;
}

.module-statusbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.module-summarybar {
  display: none;
}

.module-block--spatial > .module-header .module-copy p {
  display: none;
}

#quote-preview-panel .panel-card__header p {
  display: none;
}

.module-header__aside {
  display: grid;
  gap: 12px;
  justify-items: end;
  min-width: 240px;
}

.module-subtotal {
  display: grid;
  gap: 4px;
  min-width: 176px;
  padding: 12px 14px;
  border: 1px solid rgba(183, 121, 69, 0.16);
  border-radius: 16px;
  background: var(--accent-soft);
}

.module-subtotal span {
  color: var(--text-secondary);
  font-size: 0.76rem;
}

.module-subtotal strong {
  font-size: 1.35rem;
  line-height: 1.15;
  font-weight: 700;
  color: var(--text-primary);
}

.module-controls {
  display: grid;
  gap: 10px;
  justify-items: stretch;
  width: 100%;
}

.module-controls--stacked {
  align-content: start;
}

.module-control-group {
  display: grid;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--bg-card-soft);
}

.module-control-group--align-right {
  margin-left: auto;
  justify-items: end;
}

.module-control-group--toolbar {
  justify-self: end;
  min-height: 52px;
  margin-top: 18px;
}

.module-control-group--mode {
  justify-self: start;
  justify-items: start;
  margin-left: 0;
}

.module-control-group--mode-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  min-height: 52px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.module-control-group--inline,
.module-control-group--actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.control-caption {
  color: var(--text-muted);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-align: left;
  white-space: nowrap;
}

.mode-toggle {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 8px;
  max-width: 100%;
}

.mode-toggle input {
  display: none;
}

.mode-toggle label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.84rem;
  white-space: nowrap;
}

.mode-toggle input:checked + label {
  border-color: rgba(183, 121, 69, 0.24);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.toggle-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  color: var(--text-primary);
  white-space: nowrap;
}

.toggle-box--compact {
  min-height: 32px;
  padding: 0 10px;
}

.toggle-box input {
  margin: 0;
}

.spatial-groups {
  display: grid;
  gap: 16px;
}

.spatial-group {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-section);
  background: #fbfaf7;
}

.spatial-group__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.spatial-group__header h4 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.spatial-group__header p {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.65;
}

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

.line-row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid #e8e3dc;
  border-radius: 16px;
  background: #ffffff;
}

.line-row__field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.line-row__field-stack {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.line-row__field span,
.line-row__metric span {
  color: var(--text-secondary);
  font-size: 0.77rem;
  font-weight: 600;
  line-height: 1.3;
}

.line-row__field--category {
  grid-column: span 2;
}

.line-row__field--service {
  grid-column: span 4;
}

.line-row__field--service .field-control--multiline {
  min-height: 92px;
}

.line-row__field--price,
.line-row__field--price-unit,
.line-row__field--quantity,
.line-row__field--quantity-unit,
.line-row__field--days,
.line-row__field--difficulty,
.line-row__metric--amount {
  grid-column: span 2;
}

.line-row--spatial .line-row__field--service {
  grid-column: span 4;
}

.line-row--no-category .line-row__field--service {
  grid-column: span 6;
}

.line-row:not(.line-row--no-category) .line-row__field--service {
  grid-column: span 4;
}

.line-row:not(.line-row--no-category):not(.line-row--spatial) .line-row__field--service {
  grid-column: span 4;
}

.line-row:not(.line-row--no-category) .line-row__field--price,
.line-row:not(.line-row--no-category) .line-row__field--price-unit,
.line-row:not(.line-row--no-category) .line-row__field--quantity,
.line-row:not(.line-row--no-category) .line-row__metric--amount {
  grid-column: span 2;
}

.line-row__metric {
  display: grid;
  gap: 8px;
  align-content: center;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(183, 121, 69, 0.16);
  border-radius: 14px;
  background: #fbf8f3;
}

.line-row__metric strong {
  font-size: 1.18rem;
  line-height: 1.1;
  color: var(--text-primary);
}

.line-row__action {
  justify-self: end;
  align-self: end;
  margin-left: auto;
  min-width: 74px;
  white-space: nowrap;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
}

.line-row__support {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-soft);
}

.line-row__support-tag {
  display: inline-flex;
  width: fit-content;
  min-height: 24px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  background: #f4f1eb;
  color: var(--text-secondary);
  font-size: 0.74rem;
  align-items: center;
}

.line-row__warning {
  display: grid;
  gap: 6px;
  min-height: 18px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.75;
}

.line-row__warning p {
  margin: 0;
}

.line-row__warning a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.standard-groups {
  display: grid;
  gap: 18px;
}

.standard-group {
  display: grid;
  gap: 14px;
  padding: 20px 20px 18px;
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  background: #fffdfa;
  box-shadow: 0 3px 10px rgba(31, 41, 51, 0.035);
}

.standard-group__sections {
  display: grid;
  gap: 14px;
}

.standard-group--stack .standard-group__sections {
  grid-template-columns: 1fr;
}

.standard-group--split .standard-group__sections {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.library-pair-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
}

.standard-group__header {
  display: grid;
  gap: 8px;
  padding: 0 2px 4px;
}

.standard-group__header h4 {
  margin: 0;
  font-size: 1.28rem;
  line-height: 1.24;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.standard-group__header .card-subtitle {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.72;
}

.standard-section {
  display: grid;
  gap: 8px;
  padding: 15px 15px 13px;
  border: 1px solid rgba(217, 224, 230, 0.82);
  border-radius: 18px;
  background: #fff;
}

.standard-group--split .standard-section {
  grid-template-rows: auto auto 1fr;
  height: 100%;
}

.standard-section__title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.4;
  color: var(--text-primary);
  font-weight: 800;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(217, 224, 230, 0.72);
}

.standard-section__description {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.68;
}

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

.summary-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: var(--bg-card-soft);
}

.summary-card span {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.summary-card strong {
  font-size: 1.28rem;
  line-height: 1.14;
  color: var(--text-primary);
}

.summary-card--total {
  border-color: rgba(183, 121, 69, 0.18);
  background: var(--accent-soft);
}

.helper-list,
.project-list,
.library-list,
.history-list {
  display: grid;
  gap: 12px;
}

.helper-card,
.project-card,
.history-card,
.library-card {
  padding: 15px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: var(--bg-card);
}

.helper-card h4,
.project-card h4,
.history-card h4,
.library-card h4 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.4;
}

.helper-card p,
.project-card p,
.history-card p,
.library-card p {
  margin: 10px 0 0;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.7;
}

.library-card__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.library-card__copy {
  display: grid;
  gap: 8px;
}

.library-card__title {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text-primary);
}

.library-card__description {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.65;
}

.library-card__price {
  display: grid;
  gap: 4px;
  min-width: 136px;
  padding: 12px 14px;
  border: 1px solid rgba(183, 121, 69, 0.18);
  border-radius: 14px;
  background: #f9f6f0;
  text-align: right;
}

.library-card__price strong {
  font-size: 1.74rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.library-card__price span {
  color: var(--text-secondary);
  font-size: 0.84rem;
}

.library-card--quote {
  display: grid;
  align-items: stretch;
  min-height: 0;
  padding: 10px 11px;
  border: 1px solid #d6dde3;
  border-radius: 15px;
  background: linear-gradient(180deg, #ffffff 0%, #fdfaf5 100%);
  box-shadow: none;
}

.library-card--quote .library-card__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 10px;
  align-items: end;
  min-width: 0;
}

.library-card--quote .library-card__main {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  min-height: 102px;
  min-width: 0;
}

.library-card--quote.library-card--quote-plain .library-card__main {
  min-height: 84px;
  align-content: end;
}

.library-card--quote.library-card--quote-plain .library-card__body {
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
  align-items: end;
}

.library-card--quote .library-card__copy {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
}

.library-card--quote .library-card__title {
  font-size: 0.92rem;
  line-height: 1.32;
  font-weight: 760;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-card--quote .library-card__description {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.56;
  display: -webkit-box;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.library-card--quote .library-card__price {
  display: grid;
  gap: 4px;
  align-content: center;
  justify-items: start;
  width: 132px;
  min-width: 132px;
  min-height: 84px;
  padding: 10px 10px 9px;
  border: 1px solid rgba(183, 121, 69, 0.18);
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--text-primary);
  text-align: left;
}

.library-card--quote .library-card__price strong {
  align-self: end;
  font-size: 2.3rem;
  line-height: 0.92;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent-strong);
}

.library-card--quote .library-card__price span {
  display: block;
  width: 100%;
  font-size: 0.8rem;
  line-height: 1.32;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  color: var(--text-primary);
}

.card-actions--inline {
  margin-top: 0;
  justify-content: start;
  align-items: center;
  min-width: 0;
  padding-top: 0;
}

.card-actions--inline .button {
  white-space: nowrap;
  min-height: 34px;
  min-width: 102px;
  width: auto;
  padding: 0 14px;
  font-size: 0.82rem;
  justify-content: center;
}

.standard-groups--compact .library-card--standard p:not(.library-card__description) {
  display: none;
}

.standard-groups--compact .standard-group {
  gap: 10px;
  padding: 14px;
}

.standard-groups--compact .standard-group__sections {
  gap: 12px;
}

.standard-groups--compact .standard-group--split .standard-group__sections {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.standard-groups--compact .standard-group__header h4 {
  font-size: 1.04rem;
}

.standard-groups--compact .standard-section {
  padding: 12px 12px 11px;
}

.standard-groups--compact .standard-section__title {
  font-size: 0.94rem;
}

.standard-groups--compact .standard-section__description {
  font-size: 0.78rem;
}

.standard-groups--compact .library-card--quote {
  padding: 10px;
}

.standard-groups--compact .library-card--quote .library-card__body {
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 8px;
}

.standard-groups--compact .library-card--quote .library-card__title {
  font-size: 0.88rem;
}

.standard-groups--compact .library-card--quote .library-card__description {
  font-size: 0.74rem;
  line-height: 1.54;
}

.standard-groups--compact .library-card--quote .library-card__price strong {
  font-size: 1.98rem;
}

.standard-groups--compact .library-card--quote .library-card__price {
  width: 112px;
  min-width: 112px;
  min-height: 78px;
  padding: 9px 9px 8px;
}

.standard-groups--compact .library-card--quote .library-card__price span {
  font-size: 0.72rem;
}

.standard-groups--compact .card-actions--inline .button {
  min-width: 90px;
  min-height: 32px;
  padding: 0 11px;
}

.standard-groups--compact .library-card--quote.library-card--quote-plain .library-card__main {
  min-height: 74px;
}

.standard-groups--compact .library-card--quote.library-card--quote-plain .library-card__body {
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 7px;
}

.library-card--quote.library-card--quote-plain .card-actions--inline .button {
  min-width: 82px;
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.76rem;
}

.standard-groups--compact .library-card--quote.library-card--quote-plain .card-actions--inline .button {
  min-width: 74px;
  min-height: 30px;
  padding: 0 8px;
  font-size: 0.72rem;
}

.library-card--quote.library-card--quote-plain .library-card__price {
  width: 100%;
  min-width: 0;
}

.meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.meta-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  background: #f7f5f0;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.meta-strip--soft {
  margin-top: 0;
}

.meta-strip--soft span {
  background: #fcfaf6;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.history-deal-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: default;
  pointer-events: none;
  border-style: solid;
  border-width: 1px;
  box-shadow: inset 0 0 0 1px rgba(31, 41, 51, 0.04);
}

.history-total-tag {
  cursor: default;
  pointer-events: none;
  border-style: solid;
  border-width: 1px;
  border-color: rgba(183, 121, 69, 0.28);
  background: #fbf4ea;
  color: #8d592f;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.history-deal-tag--success {
  border-color: #9ec8aa !important;
  background: #f3fbf6;
  color: #2e6a42;
}

.history-deal-tag--pending {
  border-color: #d9b99a !important;
  background: #fff7ef;
  color: #996133;
}

.history-deal-tag--unknown {
  border-color: var(--border-soft);
  background: #f8fafc;
  color: #5b6875;
}

.similar-projects-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #ebe8e1;
  text-align: left;
  vertical-align: top;
  font-size: 0.88rem;
}

.data-table th {
  color: var(--text-secondary);
  font-weight: 700;
}

.data-table td strong {
  color: var(--text-primary);
}

.history-details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-soft);
}

.note-banner {
  padding: 12px 14px;
  border: 1px dashed rgba(183, 121, 69, 0.24);
  border-radius: 14px;
  background: #fbf7f1;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.7;
}

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

.chart-card {
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.chart-card__header {
  padding: 18px 20px 0;
}

.chart-card__header h3 {
  margin: 0;
  font-size: 1rem;
}

.chart-card__header p {
  min-height: 20px;
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.chart-card__canvas {
  height: 320px;
  padding: 8px 8px 14px;
}

.pdf-preview-frame {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: auto;
  padding: 10px;
  border-radius: var(--radius-card);
  background: #ebe6de;
}

.pdf-preview-frame--sheet {
  padding: 18px;
}

#pdf-preview {
  display: flex;
  width: 100%;
  min-width: 0;
  justify-content: center;
}

#pdf-preview .pdf-sheet {
  width: 100%;
  max-width: 210mm;
  min-height: auto;
  margin: 0 auto;
}

.pdf-sheet {
  width: 210mm;
  min-height: 297mm;
  padding: 12mm 15mm 14mm;
  border: 1px solid #ddd6cb;
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(31, 41, 51, 0.12);
  text-align: center;
}

.pdf-sheet--compact {
  font-size: 0.92rem;
}

.pdf-sheet--tight {
  font-size: 0.84rem;
}

.pdf-sheet__header {
  padding-bottom: 14px;
}

.pdf-sheet__header--formal {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.pdf-sheet h1 {
  margin: 0;
  font-size: 1.78rem;
  line-height: 1.3;
  color: var(--text-primary);
}

.pdf-sheet h2 {
  margin: 0;
  font-size: 1.38rem;
  line-height: 1.2;
  font-weight: 700;
  color: var(--text-primary);
}

.pdf-sheet__intro {
  display: grid;
  gap: 10px;
  margin: 14px 0 16px;
  color: #2f3b45;
  font-size: 0.92rem;
  line-height: 1.75;
  text-align: left;
}

.pdf-sheet__intro p {
  margin: 0;
  text-align: justify;
  text-indent: 2em;
}

.pdf-sheet__salutation {
  font-weight: 700;
  text-align: left !important;
  text-indent: 0 !important;
}

.pdf-sheet__project {
  padding: 18px 0 14px;
}

.pdf-sheet__project-title {
  font-size: 1.18rem;
  font-weight: 700;
}

.pdf-sheet__meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin-top: 12px;
}

.pdf-sheet__meta-grid span {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #ddd6cb;
  border-radius: 12px;
  background: #faf8f4;
  color: #4c5a66;
}

.pdf-sheet__meta-grid strong {
  font-size: 0.82rem;
  color: #6e7d88;
}

.pdf-sheet__table {
  width: 180mm;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin: 8px auto 0;
  font-variant-numeric: tabular-nums;
}

.pdf-sheet__col--serial {
  width: 5%;
}

.pdf-sheet__col--module {
  width: 14%;
}

.pdf-sheet__col--category {
  width: 10%;
}

.pdf-sheet__col--service {
  width: 29%;
}

.pdf-sheet__col--price {
  width: 15%;
}

.pdf-sheet__col--quantity {
  width: 14%;
}

.pdf-sheet__col--amount {
  width: 13%;
}

.pdf-sheet__table th,
.pdf-sheet__table td {
  padding: 8px 6px;
  border: 1px solid #ddd6cb;
  font-size: 0.88rem;
  line-height: 1.55;
  text-align: center;
  vertical-align: middle;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.pdf-sheet__category-cell {
  word-break: keep-all;
  overflow-wrap: normal;
}

.pdf-sheet__category-lines {
  display: inline-grid;
  gap: 2px;
  justify-items: center;
}

.pdf-sheet__category-lines > span {
  display: block;
  white-space: nowrap;
}

.pdf-sheet__table th {
  background: #f8f4ed;
  color: #33404a;
}

.pdf-sheet__table .pdf-sheet__group-cell {
  background: #faf7f1;
  font-weight: 700;
}

.pdf-sheet__table .pdf-sheet__subtotal td,
.pdf-sheet__table .pdf-sheet__grand-row td {
  font-weight: 700;
  background: #fbf8f3;
}

.pdf-sheet__wan-stack {
  display: inline-grid;
  gap: 2px;
  justify-items: center;
  line-height: 1.15;
  white-space: nowrap;
}

.pdf-sheet__wan-stack > span {
  display: block;
  white-space: nowrap;
}

.pdf-sheet__unit-price-stack {
  display: inline-grid;
  gap: 2px;
  justify-items: center;
  line-height: 1.15;
  white-space: nowrap;
}

.pdf-sheet__unit-price-stack > span {
  display: block;
  white-space: nowrap;
}

.pdf-sheet__quantity-stack {
  display: inline-grid;
  gap: 2px;
  justify-items: center;
  line-height: 1.15;
  white-space: nowrap;
}

.pdf-sheet__quantity-stack > span {
  display: block;
  white-space: nowrap;
}

.pdf-sheet__table .pdf-sheet__grand-row td {
  background: #f3eadf;
}

.pdf-sheet__notes {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #ddd6cb;
  border-radius: 12px;
  background: #faf8f4;
  color: #4c5a66;
  line-height: 1.7;
  text-align: left;
  white-space: pre-wrap;
}

.pdf-sheet__notes strong {
  display: block;
  margin-bottom: 6px;
  color: #33404a;
}

.pdf-sheet__footer {
  margin-top: 16px;
  padding-top: 16px;
  color: #4c5a66;
  font-size: 0.84rem;
  line-height: 1.8;
  text-align: right;
}

.pdf-sheet__footer--formal {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.pdf-sheet--compact .pdf-sheet__header {
  padding-bottom: 10px;
}

.pdf-sheet--compact h1 {
  font-size: 1.6rem;
}

.pdf-sheet--compact h2 {
  font-size: 1.22rem;
}

.pdf-sheet--compact .pdf-sheet__intro {
  gap: 8px;
  margin: 10px 0 12px;
  font-size: 0.86rem;
  line-height: 1.62;
}

.pdf-sheet--compact .pdf-sheet__table th,
.pdf-sheet--compact .pdf-sheet__table td {
  padding: 6px 5px;
  font-size: 0.8rem;
  line-height: 1.45;
}

.pdf-sheet--compact .pdf-sheet__notes {
  margin-top: 10px;
  padding: 10px 12px;
  font-size: 0.8rem;
  line-height: 1.55;
}

.pdf-sheet--compact .pdf-sheet__footer {
  margin-top: 12px;
  padding-top: 10px;
  font-size: 0.78rem;
  line-height: 1.6;
}

.pdf-sheet--tight .pdf-sheet__header {
  padding-bottom: 8px;
}

.pdf-sheet--tight h1 {
  font-size: 1.42rem;
}

.pdf-sheet--tight h2 {
  font-size: 1.08rem;
}

.pdf-sheet--tight .pdf-sheet__intro {
  gap: 6px;
  margin: 8px 0 10px;
  font-size: 0.8rem;
  line-height: 1.5;
}

.pdf-sheet--tight .pdf-sheet__table th,
.pdf-sheet--tight .pdf-sheet__table td {
  padding: 5px 4px;
  font-size: 0.74rem;
  line-height: 1.36;
}

.pdf-sheet--tight .pdf-sheet__notes {
  margin-top: 8px;
  padding: 8px 10px;
  font-size: 0.74rem;
  line-height: 1.48;
}

.pdf-sheet--tight .pdf-sheet__footer {
  margin-top: 10px;
  padding-top: 8px;
  font-size: 0.72rem;
  line-height: 1.45;
}

#pdf-capture-host {
  position: fixed;
  left: -9999px;
  top: 0;
  opacity: 0;
  pointer-events: none;
  background: #ffffff;
}

#pdf-capture-host .pdf-sheet {
  border: 0;
  box-shadow: none;
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  background: #fbfaf7;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.7;
}

.empty-state--compact {
  padding: 16px;
}

.app-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  max-width: 320px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(31, 41, 51, 0.94);
  color: #ffffff;
  box-shadow: 0 18px 30px rgba(31, 41, 51, 0.18);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}

.app-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

@media (max-width: 1280px) {
  .workspace,
  .chart-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 1024px) {
  .line-row,
  .line-row--scene,
  .line-row--spatial {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .line-row__field--category,
  .line-row__field--service,
  .line-row__field--price,
  .line-row__field--price-unit,
  .line-row__field--quantity,
  .line-row__field--quantity-unit,
  .line-row__field--days,
  .line-row__field--difficulty,
  .line-row__metric--amount {
    grid-column: span 1;
  }

  .line-row--no-category .line-row__field--service,
  .line-row__support,
  .line-row__metric {
    grid-column: 1 / -1;
  }

  .line-row__action {
    justify-self: end;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 12px;
  }

  .app-header {
    top: 0;
    padding: 16px;
    border-radius: 18px;
  }

  .panel-card__header,
  .panel-card__body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .header-top {
    flex-direction: column;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .module-header {
    grid-template-columns: 1fr;
  }

  .module-header__aside,
  .module-controls,
  .module-control-group--align-right,
  .module-control-group--actions,
  .spatial-group__header {
    justify-items: start;
    justify-content: flex-start;
  }

  .module-header__aside {
    min-width: 0;
  }

  .module-subtotal {
    min-width: 0;
    width: 100%;
  }

  .form-grid,
  .form-grid--compact,
  .form-grid--history,
  .summary-grid,
  .pdf-sheet__meta-grid {
    grid-template-columns: 1fr;
  }

  .form-grid--history > .field {
    grid-column: span 1;
  }

  .history-reset-button {
    justify-self: stretch;
    width: 100%;
  }

  .checkbox-group {
    grid-template-columns: 1fr;
  }

  .summary-card strong {
    font-size: 1.18rem;
  }

  .pdf-preview-frame--sheet {
    padding: 12px;
  }

  #pdf-preview .pdf-sheet {
    width: min(100%, 210mm);
    padding: 10mm;
  }
}

@media (max-width: 640px) {
  .tab-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tab-button {
    justify-content: center;
  }

  .line-row,
  .line-row--scene,
  .line-row--spatial {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 13px;
  }

  .line-row__field--category,
  .line-row__field--service,
  .line-row__field--price,
  .line-row__field--price-unit,
  .line-row__field--quantity,
  .line-row__field--quantity-unit,
  .line-row__field--days,
  .line-row__field--difficulty,
  .line-row__metric--amount,
  .line-row__support {
    grid-column: 1;
  }

  .line-row--no-category .line-row__field--service {
    grid-column: 1;
  }

  .line-row__metric {
    order: 20;
  }

  .line-row__action {
    order: 22;
    width: auto;
    justify-self: end;
  }

  .card-actions,
  .similar-projects-toolbar {
    flex-direction: column;
  }

  .card-actions .button,
  .similar-projects-toolbar .button {
    width: 100%;
  }

  .library-pair-grid {
    grid-template-columns: 1fr;
  }

  .standard-group--split .standard-group__sections,
  .standard-groups--compact .standard-group--split .standard-group__sections {
    grid-template-columns: 1fr;
  }

  .library-card--quote {
    min-height: auto;
  }

  .library-card--quote .library-card__body {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .library-card--quote .library-card__price {
    width: 100%;
    min-width: 0;
    min-height: 84px;
  }

  .card-actions--inline .button {
    width: auto;
    min-width: 116px;
  }
}

@media print {
  body,
  body.print-sheet-page {
    background: #ffffff;
  }

  body.print-sheet-page .pdf-sheet {
    width: 210mm;
    min-height: auto;
    margin: 0;
    border: none;
    padding: 12mm 15mm 14mm;
    box-shadow: none;
  }
}

