:root {
  color-scheme: light;
  --bg: #eef1f4;
  --panel: #ffffff;
  --ink: #18212f;
  --muted: #687386;
  --line: #d8dee7;
  --accent: #146c75;
  --accent-dark: #0d5158;
  --accent-soft: #e3f4f5;
  --danger: #b83232;
  --paper: #fffdf8;
  --shadow: 0 18px 50px rgba(24, 33, 47, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-auth="anonymous"] .app-header,
body[data-auth="anonymous"] .workspace,
body[data-auth="checking"] .app-header,
body[data-auth="checking"] .workspace {
  display: none;
}

body[data-auth="authenticated"] .login-screen {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef1f4;
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.login-logo {
  width: 74px;
  height: 74px;
  object-fit: contain;
  margin-bottom: 16px;
}

.login-card h1 {
  margin-bottom: 8px;
}

.login-copy,
.login-error {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.login-error {
  min-height: 1.2em;
  margin: 0;
  color: var(--danger);
  font-weight: 750;
}

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

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(16px, 3vw, 36px);
  background: #f9fafb;
  border-bottom: 1px solid var(--line);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2.4vw, 2.25rem);
  line-height: 1.1;
}

.header-actions,
.catalog-actions,
.line-toolbar,
.group-toolbar,
.library-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ui-language-picker {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.flag-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
}

.flag-button:hover,
.flag-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 750;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

[hidden] {
  display: none !important;
}

.button:hover,
.file-button:hover {
  transform: translateY(-1px);
}

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

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

.button.secondary,
.file-button {
  background: white;
  color: var(--ink);
  border-color: var(--line);
}

.button.danger {
  color: var(--danger);
  background: #fff5f5;
  border-color: #f2caca;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(390px, 0.98fr) minmax(460px, 1.02fr);
  gap: 22px;
  padding: 22px clamp(16px, 3vw, 36px) 36px;
}

body[data-preview-mode="compact"] .workspace {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
}

body[data-preview-mode="hidden"] .workspace {
  grid-template-columns: minmax(0, 1fr);
}

body[data-preview-mode="hidden"] .preview {
  display: none;
}

body[data-preview-mode="compact"] .preview {
  overflow: auto;
}

body[data-preview-mode="compact"] .preview .cover-page,
body[data-preview-mode="compact"] .preview .quote-sheet {
  min-height: auto;
  box-shadow: none;
}

body[data-preview-mode="compact"] .preview .quote-sheet {
  width: 720px;
  transform: scale(0.42);
  transform-origin: top left;
}

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

.editor {
  min-width: 0;
  overflow: hidden;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  border-bottom: 1px solid var(--line);
}

.tab {
  min-height: 48px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #f9fafb;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.tab:last-child {
  border-right: 0;
}

.tab.active {
  background: white;
  color: var(--accent);
}

.tab-view {
  display: none;
  padding: 18px;
}

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

.admin-panel {
  display: grid;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.admin-panel h2 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.admin-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.admin-form {
  align-items: end;
}

.admin-users-wrap {
  margin-top: 18px;
}

.admin-users-table button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-weight: 850;
  text-align: left;
  cursor: pointer;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 850;
}

.status-pill.off {
  background: #f6e8e8;
  color: var(--danger);
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  color: var(--ink);
}

.check-field input {
  width: auto;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  resize: vertical;
}

.line-toolbar {
  align-items: end;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #b7dadd;
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-soft);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.line-toolbar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 108, 117, 0.12);
}

.line-toolbar .search-field {
  color: var(--accent-dark);
  font-size: 0.88rem;
}

.line-toolbar #itemSearch {
  min-height: 48px;
  border-color: #9fc7cb;
}

.line-toolbar #addItemBtn {
  min-height: 48px;
  padding-inline: 22px;
}

.base-discount-panel {
  display: grid;
  gap: 11px;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.base-discount-panel > div:first-child {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.base-discount-panel span {
  color: var(--muted);
  font-size: 0.84rem;
}

.discount-inputs {
  display: grid;
  grid-template-columns: repeat(4, minmax(68px, 1fr));
  gap: 10px;
}

.discount-inputs label {
  gap: 4px;
}

.discount-inputs input {
  text-align: right;
}

.offer-discount-options {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(170px, 220px) minmax(220px, 1fr);
  align-items: end;
  gap: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.offer-discount-field input {
  text-align: right;
}

.group-toolbar {
  align-items: end;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
}

.group-toolbar label {
  flex: 1 1 280px;
}

.library-toolbar {
  align-items: end;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.library-toolbar label {
  flex: 1 1 210px;
}

.library-toolbar .small-field {
  flex: 0 0 86px;
}

.search-field {
  flex: 1 1 280px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f6f8fa;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

td input {
  min-width: 82px;
  padding: 8px;
}

.lines-table th:nth-child(2),
.lines-table td:nth-child(2) {
  width: 42px;
  min-width: 42px;
}

.lines-table th:nth-child(3),
.lines-table td:nth-child(3) {
  min-width: 92px;
}

.lines-table th:nth-child(4),
.lines-table td:nth-child(4) {
  min-width: 220px;
}

.drag-handle {
  width: 30px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f6f8fa;
  color: var(--muted);
  cursor: grab;
  font-weight: 900;
}

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

.dragging-row {
  opacity: 0.45;
}

.drag-over-row {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.row-action {
  width: 36px;
  min-height: 36px;
  border-radius: 7px;
  border: 1px solid #f2caca;
  background: #fff5f5;
  color: var(--danger);
  cursor: pointer;
  font-weight: 900;
}

.notes-field {
  margin-top: 16px;
}

.accessories-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.import-hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.catalog-filter {
  margin-top: 14px;
}

.file-button input {
  display: none;
}

.hidden-file-input {
  display: none;
}

.catalog-form {
  margin-top: 16px;
  align-items: end;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.align-end {
  align-self: end;
}

.catalog-table th:nth-child(2),
.catalog-table td:nth-child(2) {
  min-width: 92px;
}

.modal {
  max-width: min(560px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(24, 33, 47, 0.42);
}

.modal-content {
  padding: 22px;
  background: white;
}

.modal h2 {
  margin: 0 0 12px;
  font-size: 1.18rem;
}

.modal p {
  margin: 10px 0;
  color: var(--muted);
  line-height: 1.5;
}

.csv-example {
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8fa;
  overflow-x: auto;
}

.csv-example code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.catalog-table th:nth-child(3),
.catalog-table td:nth-child(3) {
  min-width: 260px;
}

.catalog-table th,
.catalog-table td {
  white-space: nowrap;
}

.catalog-table th:nth-child(2),
.catalog-table td:nth-child(2) {
  white-space: nowrap;
}

.catalog-table th:nth-child(3),
.catalog-table td:nth-child(3) {
  white-space: normal;
}

.product-image {
  display: block;
  width: 76px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f6f8fa;
  object-fit: contain;
}

.empty-image {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}

.line-meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.article-link {
  color: var(--accent-dark);
  font-weight: 900;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.lines-table .article-link {
  display: block;
  margin-bottom: 6px;
}

.title-row td,
.group-row td,
.package-row td {
  background: #eef6f6;
  color: var(--accent-dark);
  font-weight: 900;
  text-transform: uppercase;
}

.title-row td {
  background: #f8fafb;
  color: var(--ink);
  font-size: 1.04rem;
  text-transform: none;
}

.title-row textarea {
  margin-top: 8px;
}

.title-row p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.4;
  text-transform: none;
}

.package-row td {
  background: #f4efe6;
  color: #69542c;
}

.group-total-row td {
  background: #f6fbfb;
  color: var(--accent-dark);
  font-weight: 900;
  text-align: right;
}

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

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

.compare-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8fa;
}

.compare-toolbar strong,
.compare-toolbar span {
  display: block;
}

.compare-toolbar span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
}

.compare-check {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
}

.compare-check input {
  width: 20px;
  height: 20px;
}

.compare-check span {
  min-height: 18px;
  color: var(--accent-dark);
  font-weight: 900;
}

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

.saved-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.85rem;
}

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

.package-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.package-card {
  display: grid;
  align-content: start;
  gap: 9px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.package-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.package-card-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f6f8fa;
  object-fit: contain;
}

.floorplan-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.floorplan-toolbar .file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.floorplan-workspace {
  display: grid;
  grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-top: 14px;
}

.floorplan-sidebar {
  min-width: 0;
}

.floorplan-sidebar .catalog-filter {
  margin-top: 0;
}

.floorplan-symbol-list {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.floorplan-symbol-row {
  display: grid;
  grid-template-columns: 42px 52px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.floorplan-symbol-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid var(--accent-dark);
  border-radius: 50%;
  background: #fff7d6;
  color: var(--accent-dark);
  cursor: grab;
  font-weight: 950;
}

.floorplan-symbol-button.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.floorplan-symbol-row select,
.floorplan-symbol-row input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 8px;
  background: white;
  font-size: 0.82rem;
}

.floorplan-symbol-preview {
  width: 52px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f6f8fa;
  object-fit: contain;
}

.floorplan-symbol-fields {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.floorplan-item-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.floorplan-item-toggle input {
  width: auto;
  min-height: auto;
}

.floorplan-symbol-count {
  align-self: center;
  justify-self: end;
  font-weight: 950;
  font-size: 1rem;
}

.floorplan-marker-symbol,
.floorplan-print-symbol {
  display: inline-grid;
  place-items: center;
  border: 2px solid var(--accent-dark);
  border-radius: 50%;
  background: #fff7d6;
  color: var(--accent-dark);
  font-weight: 950;
}

.floorplan-trash {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 14px;
  border: 2px dashed #e39a9a;
  border-radius: 8px;
  background: #fff7f7;
  color: var(--danger);
  text-align: center;
}

.floorplan-trash strong {
  font-size: 0.98rem;
}

.floorplan-trash span {
  color: #9a4b4b;
  font-size: 0.78rem;
}

.floorplan-trash.drag-ready {
  border-color: var(--danger);
  background: #ffecec;
  box-shadow: 0 0 0 3px rgba(185, 71, 71, 0.14);
}

.floorplan-trash .button {
  width: 100%;
  min-height: 34px;
  margin-top: 6px;
}

.floorplan-board-shell {
  min-width: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f5;
}

.floorplan-board {
  position: relative;
  width: 100%;
  min-width: 420px;
  aspect-ratio: 1 / 1.414;
  overflow: hidden;
  background: white;
}

.floorplan-placeholder,
.floorplan-media,
.floorplan-overlay {
  position: absolute;
  inset: 0;
}

.floorplan-placeholder {
  z-index: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  color: var(--muted);
  text-align: center;
  font-weight: 850;
}

.floorplan-media {
  z-index: 1;
  pointer-events: none;
}

.floorplan-media img,
.floorplan-media object {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
  pointer-events: none;
}

.floorplan-overlay {
  z-index: 2;
}

.floorplan-overlay.drag-ready {
  background: rgba(20, 108, 117, 0.08);
  outline: 2px dashed var(--accent);
  outline-offset: -10px;
}

.floorplan-marker {
  position: absolute;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 5px 14px rgba(21, 36, 49, 0.18);
  cursor: move;
  transform: translate(-50%, -50%);
}

.floorplan-marker.selected {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(185, 71, 71, 0.18), 0 5px 14px rgba(21, 36, 49, 0.18);
}

.floorplan-marker-symbol {
  width: 34px;
  height: 34px;
  background: #fff7d6;
}

.floorplan-marker button {
  position: absolute;
  top: -9px;
  right: -9px;
  z-index: 3;
  width: 20px;
  min-height: 20px;
  border: 0;
  border-radius: 6px;
  background: #fff1f1;
  color: var(--danger);
  cursor: pointer;
  font-weight: 900;
  pointer-events: auto;
}

.package-card .empty-image {
  width: 100%;
  aspect-ratio: 4 / 3;
}

.package-card h3,
.package-editor h2 {
  margin: 0;
  font-size: 0.98rem;
}

.package-card p {
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.package-card-meta {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.package-card-actions {
  display: grid;
  grid-template-columns: minmax(64px, 0.55fr) 1fr;
  gap: 8px;
  align-items: end;
}

.package-card-actions input {
  min-width: 0;
}

.package-editor {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
}

.preview {
  min-width: 0;
  display: grid;
  gap: 22px;
}

.cover-page {
  position: relative;
  min-height: calc(100vh - 142px);
  overflow: hidden;
  border: 1px solid #d7dde6;
  border-radius: 8px;
  background: #e9eef3;
  box-shadow: var(--shadow);
}

.cover-page[hidden] {
  display: none;
}

.cover-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(20, 108, 117, 0.72), rgba(24, 33, 47, 0.16)),
    url("https://images.unsplash.com/photo-1600607687939-ce8a6c25118c?auto=format&fit=crop&w=1400&q=80") center/cover;
}

.cover-page[data-cover="villa"]::before {
  background:
    linear-gradient(135deg, rgba(24, 33, 47, 0.45), rgba(20, 108, 117, 0.2)),
    url("https://images.unsplash.com/photo-1600585154340-be6161a56a0c?auto=format&fit=crop&w=1400&q=80") center/cover;
}

.cover-page[data-cover="technical"]::before {
  background:
    linear-gradient(135deg, rgba(24, 33, 47, 0.75), rgba(20, 108, 117, 0.32)),
    url("https://images.unsplash.com/photo-1581092160607-ee22621dd758?auto=format&fit=crop&w=1400&q=80") center/cover;
}

.cover-page[data-cover="minimal"]::before {
  background: linear-gradient(135deg, #f7f4ed, #dbe8ea);
}

.cover-address {
  position: absolute;
  left: clamp(28px, 7vw, 70px);
  bottom: clamp(42px, 9vw, 92px);
  width: min(430px, calc(100% - 56px));
  padding: 22px;
  background: rgba(232, 234, 236, 0.88);
  border-left: 6px solid var(--accent);
  color: var(--ink);
}

.cover-address span,
.cover-address p {
  margin: 0;
  color: var(--muted);
}

.cover-address strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 1.35rem;
}

.quote-sheet {
  min-height: calc(100vh - 142px);
  background: var(--paper);
  border: 1px solid #e8dfce;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 46px);
}

.quote-top,
.recipient,
.quote-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.company-block {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.company-logo {
  width: 92px;
  height: 64px;
  object-fit: contain;
}

.brand {
  margin: 0 0 10px;
  font-size: 1.35rem;
  font-weight: 900;
}

.company-lines,
.quote-meta p,
.recipient p {
  margin: 0;
  color: var(--muted);
}

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

.quote-meta strong,
.quote-meta span,
.recipient strong,
.recipient span,
.quote-footer strong,
.quote-footer span {
  display: block;
}

.quote-meta strong {
  margin: 8px 0;
  font-size: 1.25rem;
}

.recipient {
  margin: 34px 0 24px;
  padding: 18px 0;
  border-top: 1px solid #e8dfce;
  border-bottom: 1px solid #e8dfce;
}

.recipient strong {
  margin-top: 4px;
  font-size: 1.1rem;
}

.preview-table th {
  background: #f4efe6;
}

.preview-table {
  table-layout: fixed;
}

.preview-table th,
.preview-table td {
  padding: 8px 7px;
  font-size: 0.84rem;
}

.preview-table th {
  font-size: 0.66rem;
}

.preview-table th:nth-child(1),
.preview-table td:nth-child(1) {
  width: 13%;
}

.preview-table th:nth-child(2),
.preview-table td:nth-child(2) {
  width: 13%;
}

.preview-table th:nth-child(3),
.preview-table td:nth-child(3) {
  width: 31%;
}

.preview-table th:nth-child(4),
.preview-table td:nth-child(4) {
  width: 7%;
}

.preview-table th:nth-child(5),
.preview-table td:nth-child(5),
.preview-table th:nth-child(6),
.preview-table td:nth-child(6),
.preview-table th:nth-child(7),
.preview-table td:nth-child(7) {
  width: 12%;
}

body[data-discount-column="hidden"] .preview-table th:nth-child(3),
body[data-discount-column="hidden"] .preview-table td:nth-child(3) {
  width: 38%;
}

body[data-discount-column="hidden"] .preview-table th:nth-child(6),
body[data-discount-column="hidden"] .preview-table td:nth-child(6) {
  display: none;
}

.preview-table td:last-child,
.preview-table th:last-child,
.preview-table td:nth-child(4),
.preview-table th:nth-child(4),
.preview-table td:nth-child(5),
.preview-table th:nth-child(5),
.preview-table td:nth-child(6),
.preview-table th:nth-child(6),
.preview-table td:nth-child(7),
.preview-table th:nth-child(7) {
  text-align: right;
}

.preview-table .product-image {
  width: 54px;
  height: 42px;
}

.compare-sheet {
  display: block;
}

.compare-sheet[hidden] {
  display: none;
}

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

.compare-summary div {
  padding: 10px;
  border: 1px solid #e8dfce;
  border-radius: 8px;
  background: #faf8f3;
}

.compare-summary span,
.compare-summary strong {
  display: block;
}

.compare-summary span {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.compare-summary strong {
  margin-top: 5px;
  font-size: 1rem;
}

.compare-table {
  table-layout: fixed;
}

.compare-table th,
.compare-table td {
  padding: 7px;
  font-size: 0.78rem;
}

.compare-table th {
  background: #f4efe6;
}

.compare-table td:nth-child(n+3),
.compare-table th:nth-child(n+3) {
  text-align: right;
}

.compare-table .positive td:last-child {
  color: var(--danger);
  font-weight: 900;
}

.compare-table .negative td:last-child,
.quote-meta .negative {
  color: var(--accent-dark);
  font-weight: 900;
}

body[data-view="compare"] .cover-page,
body[data-view="compare"] #quoteSheet {
  display: none;
}

.totals {
  width: min(380px, 100%);
  margin: 24px 0 0 auto;
  border-top: 1px solid #e8dfce;
}

.totals div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid #e8dfce;
}

.grand-total {
  font-size: 1.18rem;
}

.quote-footer {
  margin-top: 34px;
  color: var(--muted);
}

.quote-footer div {
  flex: 1;
}

.quote-footer strong {
  margin-bottom: 6px;
  color: var(--ink);
}

.logistics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 28px;
  padding: 12px 0;
  border-top: 1px solid #e8dfce;
  border-bottom: 1px solid #e8dfce;
}

.logistics div {
  display: grid;
  gap: 4px;
}

.logistics span,
.signature-box span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.terms {
  margin-top: 24px;
  color: var(--muted);
  white-space: pre-wrap;
}

.signature-box {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 28px;
  margin-top: 42px;
}

.signature-box div {
  min-height: 84px;
  border-top: 1px solid var(--ink);
  padding-top: 8px;
}

body[data-template="compact"] .quote-sheet {
  padding: 26px;
}

body[data-template="compact"] .line-meta,
body[data-template="compact"] .product-image {
  display: none;
}

body[data-template="classic"] .item-details {
  display: none;
}

body[data-template="technical"] .quote-sheet {
  --paper: #fbfcfd;
  border-color: #b9c7d4;
}

body[data-template="technical"] .preview-table th {
  background: #dde8ee;
}

body[data-template="signature"] .signature-box {
  min-height: 150px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(380px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .quote-sheet {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .app-header,
  .quote-top,
  .recipient,
  .quote-footer,
  .saved-item {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

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

  .offer-discount-options {
    grid-template-columns: 1fr;
  }

  .floorplan-workspace {
    grid-template-columns: 1fr;
  }

  .floorplan-symbol-list {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  }

  .floorplan-board {
    min-width: 320px;
  }

  .quote-meta {
    text-align: left;
  }

  .logistics,
  .signature-box {
    grid-template-columns: 1fr;
  }
}

.floorplan-print-sheet {
  display: none;
}

.floorplan-print-page {
  width: min(900px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 24px;
  background: white;
  page-break-after: always;
  break-after: page;
}

.floorplan-print-page:last-child {
  page-break-after: auto;
  break-after: auto;
}

.floorplan-print-page h1 {
  margin-bottom: 18px;
  font-size: 1.35rem;
}

.floorplan-print-board {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.414;
  overflow: hidden;
  border: 1px solid var(--line);
  background: white;
}

.floorplan-print-map-page {
  display: grid;
  place-items: center;
}

.floorplan-print-plan {
  width: 100%;
}

.floorplan-print-board .floorplan-media,
.floorplan-print-board .floorplan-placeholder {
  position: absolute;
  inset: 0;
}

.floorplan-print-board > img,
.floorplan-print-board > object {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
}

.floorplan-print-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
}

.floorplan-print-symbol {
  position: absolute;
  width: 30px;
  height: 30px;
  transform: translate(-50%, -50%);
}

.floorplan-print-symbol.static {
  position: static;
  width: 38px;
  height: 38px;
  transform: none;
}

.floorplan-print-legend {
  display: grid;
  gap: 10px;
}

.floorplan-print-row {
  display: grid;
  grid-template-columns: 44px 48px 76px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.floorplan-print-row img,
.floorplan-print-row .empty-image {
  width: 76px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 7px;
  object-fit: contain;
}

.floorplan-print-row h2 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.floorplan-print-row p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

@media print {
  body {
    background: white;
  }

  .no-print,
  .toast {
    display: none !important;
  }

  .workspace {
    display: block;
    padding: 0;
  }

  .preview {
    width: 100%;
    display: block;
  }

  .cover-page {
    min-height: 100vh;
    page-break-after: always;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .quote-sheet {
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
  }

  body[data-view="compare"] .compare-sheet {
    display: block !important;
  }

  body[data-view="floorplan-print"] .workspace,
  body[data-view="floorplan-print"] .preview {
    display: none !important;
  }

  body[data-view="floorplan-print"] .floorplan-print-sheet {
    display: block !important;
  }

  body[data-view="floorplan-print"] .floorplan-print-page {
    width: 100%;
    min-height: 100vh;
    padding: 0;
    page-break-after: always;
    break-after: page;
  }

  body[data-view="floorplan-print"] .floorplan-print-page:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  body[data-view="floorplan-print"] .floorplan-print-map-page {
    height: 100vh;
    overflow: hidden;
  }

  body[data-view="floorplan-print"] .floorplan-print-plan,
  body[data-view="floorplan-print"] .floorplan-print-board {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
  }
}
