: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 .cover-page {
  width: 302px;
  height: auto;
  aspect-ratio: 210 / 297;
}

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;
}

.ai-quote-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(360px, 1.15fr);
  gap: 16px;
  align-items: start;
}

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

.ai-quote-panel textarea {
  min-height: 300px;
}

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

.section-title h2 {
  margin: 0;
  font-size: 1rem;
}

.section-title span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.ai-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.ai-proposal-wrap {
  margin-top: 0;
}

.ai-proposal-table td:first-child,
.ai-proposal-table th:first-child {
  width: 34px;
}

.ai-proposal-table input,
.ai-proposal-table select {
  width: 100%;
  min-width: 0;
}

.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);
}

.presence-cell {
  min-width: 145px;
}

.presence-cell small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
}

.quote-lock-pill {
  width: fit-content;
  margin-top: 6px;
  font-size: 0.78rem;
}

.package-translations {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.package-translations-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
}

.package-translations-head span {
  color: var(--muted);
  font-size: 0.82rem;
}

.package-translations-head .button {
  grid-row: 1 / span 2;
  grid-column: 2;
  white-space: nowrap;
}

.package-translation-grid {
  display: grid;
  gap: 10px;
}

.package-translation-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) minmax(0, 1.5fr);
  gap: 10px;
  align-items: start;
}

.package-translation-row b {
  padding-top: 10px;
  color: var(--accent-dark);
}

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

.quote-collapse {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.quote-collapse:first-child {
  margin-top: 0;
}

.quote-collapse summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 11px 13px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 900;
}

.quote-collapse summary::-webkit-details-marker {
  display: none;
}

.quote-collapse summary::before {
  content: "▾";
  color: var(--muted);
  transition: transform 0.18s ease;
}

.quote-collapse:not([open]) summary::before {
  transform: rotate(-90deg);
}

.quote-collapse summary strong {
  margin-right: auto;
}

.quote-collapse summary span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.quote-collapse > .form-grid,
.quote-collapse > .discount-inputs,
.quote-collapse > .offer-discount-options {
  margin: 0 13px 13px;
}

.vat-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
}

.quote-insert-area {
  position: sticky;
  top: 0;
  z-index: 8;
  margin-top: 18px;
  padding: 10px;
  border: 1px solid #b7dadd;
  border-radius: 8px;
  background: rgba(238, 247, 247, 0.96);
  box-shadow: 0 10px 20px rgba(24, 33, 47, 0.08);
}

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);
}

input:disabled,
select:disabled,
textarea:disabled,
.readonly-field {
  background: #f3f5f7;
  color: #596273;
  cursor: not-allowed;
  opacity: 1;
}

textarea {
  resize: vertical;
}

.line-toolbar {
  align-items: end;
  margin-top: 10px;
  padding: 14px;
  border: 1px solid #b7dadd;
  border-left: 4px 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: 0;
  border-color: #ead28a;
  background: #fff8dc;
}

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

.base-discount-panel .summary-extra {
  color: #8b6a09;
  font-weight: 900;
}

.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 #ead28a;
}

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

.icon-toggle {
  width: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.95rem;
}

.icon-toggle.active {
  border-color: var(--accent);
  background: #eaf6f4;
  color: var(--accent-dark);
}

.group-toolbar {
  align-items: end;
  margin-top: 0;
  padding: 12px;
  border: 1px solid #b7dadd;
  border-radius: 8px;
  background: var(--accent-soft);
}

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

.library-toolbar {
  display: grid;
  align-items: stretch;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #b7dadd;
  border-radius: 8px;
  background: var(--accent-soft);
}

.library-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto auto;
  gap: 10px;
  align-items: end;
}

.library-row + .library-row {
  margin-top: 10px;
}

.library-row label {
  min-width: 0;
}

.library-row .small-field {
  width: 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;
}

.lines-table tr.selected-row > td {
  box-shadow: inset 0 0 0 2px rgba(20, 108, 117, 0.28);
}

.block-end-row td {
  padding: 4px 10px;
  background: #fbfcfd;
  text-align: center;
}

.block-end-row td:first-child,
.block-end-row td:last-child {
  width: 42px;
}

.block-end-row span {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 10px;
  border-radius: 999px;
  background: white;
  color: var(--muted);
  border: 1px dashed var(--line);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.package-end-row span {
  border-color: #d8bf83;
  color: #69542c;
}

.group-end-row span {
  border-color: #a9d1d4;
  color: var(--accent-dark);
}

.block-end-row.selected-row td {
  background: var(--accent-soft);
}

.row-action {
  width: auto;
  min-width: 36px;
  min-height: 36px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

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

.catalog-row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

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

.line-note-input {
  margin-top: 6px;
  min-height: 44px;
  font-size: 0.78rem;
}

.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;
}

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

.password-panel h3 {
  margin: 0 0 12px;
  font-size: 0.98rem;
}

.password-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

.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;
}

.wide-modal .modal-content {
  width: min(900px, calc(100vw - 32px));
}

.finish-change-panels {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

.finish-page {
  display: grid;
  gap: 14px;
}

.finish-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.finish-page-head h2 {
  margin: 0 0 4px;
}

.finish-change-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.finish-change-panel.target-panel {
  background: #fff8e1;
  border-color: #f1d67a;
}

.finish-change-panel h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: var(--ink);
}

.finish-change-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
}

.finish-preview-wrap {
  max-height: 62vh;
  overflow: auto;
}

.manual-finish-match {
  display: grid;
  gap: 6px;
  min-width: 190px;
}

.manual-finish-match select {
  width: 100%;
}

.ok-text {
  color: #1f7a45;
  font-weight: 700;
}

.warning-text {
  color: #a15c00;
  font-weight: 700;
}

.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;
}

.prompt-textarea {
  min-height: 260px;
  margin-top: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.45;
}

.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;
}

.catalog-table tr.selected-row td {
  background: var(--accent-soft);
}

.icon-row-action {
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.05rem;
  line-height: 1;
}

.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;
  font-weight: 500;
  line-height: 1.35;
  text-transform: none;
}

.line-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  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;
}

.pdf-document .title-row td {
  padding: 9px 6px 6px;
}

.pdf-document .title-row strong {
  font-size: 0.88rem;
}

.pdf-document .title-row p {
  margin-top: 4px;
  font-size: 0.68rem;
  font-weight: 400;
  line-height: 1.32;
}

.pdf-document .group-row td,
.pdf-document .package-row td {
  padding: 6px;
  font-size: 0.72rem;
}

.package-end-preview-row td {
  padding: 0;
  height: 8px;
  border-bottom: 2px solid #d8bf83;
}

.pdf-document .package-end-preview-row td {
  height: 5px;
  border-bottom-width: 1px;
}

.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: 7px;
  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: grid;
  gap: 10px;
}

.floorplan-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.floorplan-action-tools {
  background: #fffdf5;
}

.floorplan-plan-picker,
.floorplan-plan-name,
.floorplan-system-title {
  display: grid;
  gap: 4px;
  min-width: min(230px, 100%);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.floorplan-plan-picker select,
.floorplan-plan-name input,
.floorplan-system-title input {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
}

.floorplan-plan-name input,
.floorplan-system-title input {
  padding: 0 10px;
}

.floorplan-print-scope {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.floorplan-print-scope select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
}

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

.floorplan-palettes {
  display: grid;
  gap: 9px;
}

.floorplan-palette {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.floorplan-palette summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 7px 9px;
  cursor: pointer;
  list-style: none;
}

.floorplan-palette summary::-webkit-details-marker {
  display: none;
}

.floorplan-palette summary span {
  font-weight: 950;
}

.floorplan-palette summary b {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #eef2f4;
  color: var(--ink);
  font-size: 0.78rem;
}

.floorplan-palette summary button {
  min-width: 28px;
  min-height: 28px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 950;
}

.floorplan-print-toggle {
  background: #e8edf1 !important;
  color: #4c5b68 !important;
}

.floorplan-print-toggle.active {
  background: var(--accent) !important;
  color: white !important;
}

.floorplan-palette[data-category="byme-knx"] { border-color: #9fcbb5; background: #f4fbf7; }
.floorplan-palette[data-category="byalarm"] { border-color: #e5a4a4; background: #fff6f6; }
.floorplan-palette[data-category="elvox"] { border-color: #9ebce7; background: #f4f8ff; }
.floorplan-palette[data-category="wired"] { border-color: #c9ad8b; background: #fbf7f1; }
.floorplan-palette[data-category="control"] { border-color: #e7ce75; background: #fffaf0; }

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

.floorplan-sidebar {
  min-width: 0;
  display: grid;
  gap: 10px;
  align-self: start;
}

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

.floorplan-symbol-list {
  display: grid;
  gap: 9px;
  padding: 9px;
}

.floorplan-placement-list {
  display: grid;
  gap: 7px;
  max-height: 260px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.floorplan-placement-list:empty {
  display: none;
}

.floorplan-placement-list > strong {
  font-size: 0.86rem;
}

.floorplan-placement-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.floorplan-placement-row.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.floorplan-placement-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floorplan-placement-row b {
  color: var(--muted);
  font-size: 0.74rem;
}

.floorplan-placement-row i {
  color: var(--danger);
  font-style: normal;
  font-weight: 900;
}

.floorplan-symbol-row {
  display: grid;
  grid-template-columns: 42px 52px minmax(32px, 1fr) 28px;
  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-palette[data-category="byme-knx"] .floorplan-symbol-button,
.floorplan-marker[data-category="byme-knx"] .floorplan-marker-symbol,
.floorplan-print-symbol[data-category="byme-knx"] {
  border-color: #24704a;
  background: #e2f5e9;
  color: #155437;
}

.floorplan-palette[data-category="byalarm"] .floorplan-symbol-button,
.floorplan-marker[data-category="byalarm"] .floorplan-marker-symbol,
.floorplan-print-symbol[data-category="byalarm"] {
  border-color: #a33a3a;
  background: #ffe5e5;
  color: #7b2424;
}

.floorplan-palette[data-category="elvox"] .floorplan-symbol-button,
.floorplan-marker[data-category="elvox"] .floorplan-marker-symbol,
.floorplan-print-symbol[data-category="elvox"] {
  border-color: #2f5f9e;
  background: #e5efff;
  color: #214a7d;
}

.floorplan-palette[data-category="wired"] .floorplan-symbol-button,
.floorplan-marker[data-category="wired"] .floorplan-marker-symbol,
.floorplan-print-symbol[data-category="wired"] {
  border-color: #795437;
  background: #f4e7d7;
  color: #583b25;
}

.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-preview-link {
  display: block;
  width: 52px;
  height: 42px;
  border-radius: 7px;
}

.floorplan-symbol-preview-link:hover .floorplan-symbol-preview {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.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: center;
  font-weight: 950;
  font-size: 1rem;
}

.floorplan-symbol-delete {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: #fde7e7;
  color: var(--danger);
  cursor: pointer;
  font-weight: 950;
  line-height: 1;
}

.floorplan-symbol-delete:hover {
  background: #f9caca;
}

.control-points-panel {
  display: grid;
  gap: 9px;
  margin-top: 14px;
  padding: 10px;
  border: 1px solid #c7d7e5;
  border-radius: 8px;
  background: #f5f9fc;
}

.control-points-panel > strong {
  font-size: 0.86rem;
}

.control-point-list {
  display: grid;
  gap: 7px;
}

.control-point-button {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  cursor: grab;
  text-align: left;
}

.control-point-button.selected {
  border-color: #456a9a;
  box-shadow: 0 0 0 3px rgba(69, 106, 154, 0.14);
}

.control-point-button span {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 28px;
  border: 2px solid #456a9a;
  border-radius: 8px;
  background: #eaf2ff;
  color: #24486f;
  font-size: 0.72rem;
  font-weight: 950;
}

.control-point-button b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
}

.control-point-button i {
  color: #24486f;
  font-style: normal;
  font-weight: 950;
  text-align: right;
}

.control-point-summary {
  display: grid;
  gap: 5px;
  padding-top: 7px;
  border-top: 1px solid #d9e4ee;
}

.control-point-summary div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.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-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%);
  pointer-events: auto;
  touch-action: none;
}

.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 {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid var(--accent-dark);
  border-radius: 50%;
  background: #fff7d6;
  color: var(--accent-dark);
  font-weight: 900;
  pointer-events: none;
}

.control-point-marker .floorplan-marker-symbol {
  width: auto;
  min-width: 34px;
  padding: 0 5px;
  border-color: #456a9a;
  border-radius: 8px;
  background: #eaf2ff;
  color: #24486f;
  font-size: 0.72rem;
}

.floorplan-print-symbol[data-category="control"],
.control-point-marker .floorplan-marker-symbol {
  border-color: #a47a13;
  background: #fff1bd;
  color: #6c4b02;
}

.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;
}

.automation-proposal-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #cdd9df;
  border-radius: 8px;
  background: #f8fafb;
}

.automation-proposal-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.automation-proposal-head strong {
  display: inline-block;
  margin-bottom: 3px;
}

.automation-proposal-head .floorplan-print-toggle {
  margin-right: 7px;
  vertical-align: middle;
}

.automation-proposal-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.automation-proposal-head label {
  display: grid;
  gap: 4px;
  min-width: 150px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.automation-proposal-head select,
.automation-proposal-table input {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
}

.automation-proposal-table-wrap {
  overflow: auto;
}

.automation-proposal-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: white;
}

.automation-proposal-table th,
.automation-proposal-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 0.84rem;
}

.automation-proposal-table th {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.automation-proposal-table td:first-child,
.automation-proposal-table td:nth-child(5) {
  width: 76px;
  text-align: center;
}

.automation-proposal-table input {
  width: 100%;
  padding: 0 8px;
}

.automation-proposal-table .product-image,
.automation-proposal-table .empty-image {
  width: 58px;
  height: 44px;
  object-fit: contain;
}

.automation-proposal-table td strong,
.automation-proposal-table td span {
  display: block;
}

.automation-proposal-table td span {
  margin-top: 2px;
  color: var(--muted);
  line-height: 1.3;
}

.automation-proposal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
}

.automation-proposal-footer strong {
  color: var(--ink);
}

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

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

.package-card h3,
.package-editor h2 {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.2;
}

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

.package-card-meta {
  color: var(--muted);
  font-size: 0.72rem;
  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);
  aspect-ratio: 210 / 297;
  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, #f7f8fa, #e9eef3);
}

.cover-page[data-cover="villa"]::before {
  background: linear-gradient(135deg, #f7f8fa, #e9eef3);
}

.cover-page[data-cover="technical"]::before {
  background: linear-gradient(135deg, #f7f8fa, #e9eef3);
}

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

.cover-page[data-cover="custom"]::before {
  background:
    linear-gradient(135deg, rgba(24, 33, 47, 0.42), rgba(24, 33, 47, 0.08)),
    var(--cover-image) center/cover;
}

.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);
}

.pdf-document .quote-sheet {
  width: 210mm;
  min-height: 297mm;
  box-sizing: border-box;
  padding: 13mm 12mm 14mm;
}

.pdf-document .cover-page {
  width: 210mm;
  min-height: 297mm;
  aspect-ratio: 210 / 297;
  box-sizing: border-box;
}

.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;
}

.pdf-document .company-logo {
  width: 72px;
  height: 52px;
}

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

.pdf-document .brand {
  margin-bottom: 5px;
  font-size: 1.03rem;
  letter-spacing: 0;
}

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

.pdf-document .company-lines,
.pdf-document .quote-meta p,
.pdf-document .recipient p {
  font-size: 0.72rem;
  line-height: 1.35;
}

.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;
}

.pdf-document .quote-meta {
  min-width: 118px;
}

.pdf-document .quote-meta strong {
  margin: 4px 0;
  font-size: 0.98rem;
}

.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;
}

.recipient.recipient-empty {
  min-height: 56px;
  padding: 12px 0;
}

.recipient.recipient-empty > * {
  visibility: hidden;
}

.pdf-document .recipient {
  margin: 20px 0 16px;
  padding: 11px 0;
}

.pdf-document .recipient.recipient-empty {
  min-height: 34px;
  padding: 8px 0;
}

.pdf-document .recipient strong {
  font-size: 0.92rem;
}

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

.preview-table {
  table-layout: fixed;
  width: 100%;
}

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

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

.pdf-document .preview-table th,
.pdf-document .preview-table td {
  padding: 5px 5px;
  font-size: 0.68rem;
  line-height: 1.28;
}

.pdf-document .preview-table th {
  font-size: 0.56rem;
  letter-spacing: 0.02em;
}

.preview-table .code-col {
  width: 13%;
}

.preview-table .photo-col {
  width: 12%;
}

.preview-table .description-col {
  width: 32%;
}

.preview-table .quantity-col {
  width: 7%;
}

.preview-table .price-col,
.preview-table .discount-col,
.preview-table .total-col {
  width: 12%;
}

body[data-discount-column="hidden"] .preview-table .description-col {
  width: 43%;
}

body[data-discount-column="hidden"] .preview-table .price-col,
body[data-discount-column="hidden"] .preview-table .total-col {
  width: 12.5%;
}

.preview-table .quantity-col,
.preview-table .price-col,
.preview-table .discount-col,
.preview-table .total-col {
  text-align: right;
}

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

.pdf-document .preview-table .product-image {
  width: 42px;
  height: 32px;
}

.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);
}

.sync-status {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.sync-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: #98a3b3;
  box-shadow: 0 0 0 3px rgba(152, 163, 179, 0.16);
}

.sync-status[data-status="saved"] .sync-dot {
  background: #2f9b63;
  box-shadow: 0 0 0 3px rgba(47, 155, 99, 0.16);
}

.sync-status[data-status="saving"] .sync-dot,
.sync-status[data-status="checking"] .sync-dot {
  background: #d99a22;
  box-shadow: 0 0 0 3px rgba(217, 154, 34, 0.18);
  animation: syncPulse 1.1s ease-in-out infinite;
}

.sync-status[data-status="offline"] .sync-dot,
.sync-status[data-status="error"] .sync-dot {
  background: #d74444;
  box-shadow: 0 0 0 3px rgba(215, 68, 68, 0.16);
}

.sync-status[data-status="browser"] .sync-dot {
  background: #64748b;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.16);
}

body[data-auth="anonymous"] .sync-status,
body[data-auth="checking"] .sync-status {
  display: none;
}

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

@keyframes syncPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.35);
    opacity: 0.72;
  }
}

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

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

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

  .finish-change-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@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;
  }

  .finish-change-grid {
    grid-template-columns: 1fr;
  }

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

  .quote-insert-area {
    position: static;
  }

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

  .library-row .small-field {
    width: 100%;
  }

  .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: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  color: #18212f;
  font-size: 1.18rem;
  letter-spacing: 0;
}

.floorplan-print-cover-page {
  display: block;
}

.floorplan-print-cover {
  position: relative;
  min-height: calc(100dvh - 48px);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #ffffff;
}

.floorplan-cover-grid {
  display: none;
}

.floorplan-cover-grid span {
  position: absolute;
  width: 220px;
  height: 2px;
  background: #d6a328;
  transform: rotate(-28deg);
}

.floorplan-cover-grid span:nth-child(1) { left: 12%; top: 24%; }
.floorplan-cover-grid span:nth-child(2) { right: 9%; top: 38%; width: 150px; }
.floorplan-cover-grid span:nth-child(3) { left: 18%; bottom: 18%; width: 170px; }
.floorplan-cover-grid span:nth-child(4) { right: 18%; bottom: 26%; width: 240px; }

.floorplan-cover-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px;
}

.floorplan-cover-brand img {
  width: 62px;
  height: 62px;
  object-fit: contain;
}

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

.floorplan-cover-brand strong {
  font-size: 1.08rem;
}

.floorplan-cover-brand span {
  color: var(--muted);
}

.floorplan-cover-title {
  position: relative;
  z-index: 1;
  margin: 190px 52px 0;
  max-width: 640px;
}

.floorplan-cover-title p {
  margin: 0 0 14px;
  color: #146c75;
  font-size: 0.9rem;
  font-weight: 900;
  text-transform: uppercase;
}

.floorplan-cover-title h1 {
  margin: 0;
  font-size: 2.6rem;
  line-height: 1.05;
}

.floorplan-cover-title h2 {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.15rem;
  font-weight: 650;
  line-height: 1.35;
}

.floorplan-cover-meta {
  position: absolute;
  left: 52px;
  right: 52px;
  bottom: 38px;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-weight: 850;
}

.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-map-title {
  width: 100%;
  margin: 0 0 8px;
  padding: 0 0 7px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.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: 26px;
  height: 26px;
  font-size: 0.74rem;
  transform: translate(-50%, -50%);
}

.floorplan-print-symbol.static {
  position: static;
  width: 32px;
  height: 32px;
  font-size: 0.74rem;
  transform: none;
}

.control-point-print-symbol {
  width: auto;
  min-width: 30px;
  padding: 0 5px;
  border-color: #456a9a;
  border-radius: 8px;
  background: #eaf2ff;
  color: #24486f;
  font-size: 0.68rem;
}

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

.floorplan-print-legend-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.floorplan-print-legend-section h2 {
  margin: 0;
  padding: 7px 10px;
  background: #f5f7f9;
  color: #253044;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

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

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

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

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

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

.floorplan-print-section {
  margin-top: 18px;
}

.floorplan-print-section h1 {
  margin: 0 0 12px;
  font-size: 1.02rem;
}

.floorplan-print-technical-section {
  break-before: page;
  page-break-before: always;
  margin-top: 0;
}

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

.floorplan-print-table th,
.floorplan-print-table td {
  padding: 6px 7px;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  text-align: left;
  vertical-align: middle;
}

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

.floorplan-print-table th {
  color: var(--muted);
  background: #f5f7f9;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.floorplan-print-table .product-image,
.floorplan-print-table .empty-image {
  width: 50px;
  height: 38px;
  object-fit: contain;
}

.floorplan-print-table small {
  color: var(--muted);
}

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

.project-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.project-head h2 {
  margin: 0 0 4px;
  font-size: 1.08rem;
}

.project-head p {
  margin: 0;
  max-width: 680px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

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

.project-summary {
  padding: 9px 12px;
  border: 1px solid #d7e0e5;
  border-radius: 8px;
  background: #f7fafb;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.byme-backup-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.byme-backup-summary span,
.byme-backup-summary strong {
  color: var(--ink);
  font-weight: 800;
}

.byme-missing-list {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #d7e0e5;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
}

.byme-missing-list strong {
  color: var(--ink);
}

.byme-missing-list span,
.byme-missing-list em {
  font-style: normal;
  font-weight: 600;
}

.byme-map-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(110px, 150px);
  gap: 8px;
  align-items: center;
}

.byme-map-row span {
  display: grid;
  gap: 1px;
}

.byme-map-row em {
  color: var(--muted);
  font-size: 0.72rem;
}

.byme-map-row input {
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 0.76rem;
}

.byme-mapping-list {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #d7e0e5;
}

.byme-mapping-list summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--ink);
}

.byme-mapping-list p {
  margin: 6px 0 8px;
  color: var(--muted);
  font-size: 0.76rem;
}

.knx-datapoint-panel {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #d7e0e5;
}

.knx-datapoint-panel > strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.knx-datapoint-panel > span,
.knx-datapoint-panel > em {
  color: var(--muted);
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 600;
}

.compact-table th,
.compact-table td {
  padding: 6px 7px;
  font-size: 0.72rem;
  line-height: 1.25;
  vertical-align: top;
}

.project-grid {
  display: grid;
  grid-template-columns: minmax(190px, 250px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.wiring-page-list {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 7px;
  max-height: calc(100dvh - 190px);
  overflow: auto;
}

.wiring-page-list button {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.wiring-page-list button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.wiring-page-list span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

.wiring-page-list small {
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.2;
}

.wiring-preview {
  display: grid;
  gap: 16px;
  min-width: 0;
  padding-bottom: 28px;
}

.project-empty {
  min-height: 160px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: white;
}

.wiring-sheet {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 8px;
  width: 100%;
  aspect-ratio: 1.414 / 1;
  min-height: 500px;
  max-height: 720px;
  padding: 12px;
  border: 2px solid #243042;
  border-radius: 8px;
  background: white;
  box-shadow: 0 12px 28px rgba(22, 31, 45, 0.08);
}

.wiring-sheet-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #243042;
  font-size: 0.72rem;
}

.wiring-company,
.wiring-company strong,
.wiring-company span {
  display: grid;
  gap: 2px;
}

.wiring-company span,
.wiring-sheet-top p {
  margin: 0;
  color: var(--muted);
}

.wiring-project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  border: 1px solid #243042;
  border-bottom: 0;
}

.wiring-project-grid div {
  min-height: 42px;
  padding: 5px 7px;
  border-right: 1px solid #243042;
  border-bottom: 1px solid #243042;
}

.wiring-project-grid div:nth-child(3n) {
  border-right: 0;
}

.wiring-project-grid span,
.wiring-footer span {
  display: block;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
}

.wiring-project-grid strong {
  display: block;
  margin-top: 3px;
  font-size: 0.76rem;
}

.wiring-main {
  display: grid;
  grid-template-columns: 1fr minmax(190px, 0.9fr) 1fr;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.wiring-column,
.wiring-device {
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  min-width: 0;
}

.wiring-column h3,
.wiring-device h3 {
  margin: 0;
  padding: 6px 7px;
  border: 1px solid #243042;
  border-bottom: 0;
  background: #f4f6f8;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.wiring-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.wiring-table th,
.wiring-table td {
  padding: 4px 5px;
  border: 1px solid #243042;
  font-size: 0.66rem;
  height: 18px;
  min-height: 18px;
  max-height: 28px;
  overflow: hidden;
  text-align: left;
  vertical-align: top;
}

.wiring-table th {
  background: #f8fafb;
  color: var(--muted);
  text-transform: uppercase;
}

.wiring-table .wiring-group-row td {
  padding: 4px 6px;
  height: 17px;
  background: #eef1f4;
  color: #253044;
  font-weight: 900;
  text-transform: uppercase;
}

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

.wiring-table th:nth-child(3),
.wiring-table td:nth-child(3) {
  width: 42px;
  text-align: center;
}

.wiring-terminal-cell {
  font-weight: 850;
  text-align: center;
}

.wiring-device {
  align-content: start;
  text-align: center;
}

.wiring-device img,
.wiring-empty-image {
  width: 100%;
  max-height: 250px;
  min-height: 150px;
  border: 1px solid #243042;
  object-fit: contain;
  background: #fff;
}

.wiring-empty-image {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 900;
}

.wiring-device strong,
.wiring-device span {
  display: block;
  margin-top: 8px;
}

.wiring-device span {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.3;
}

.wiring-datasheet-link {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-left: 6px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.72rem;
}

.wiring-template-editor,
.wiring-project-settings {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.wiring-template-editor summary,
.wiring-project-settings summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.wiring-template-editor summary span,
.wiring-project-settings summary span {
  color: var(--muted);
  font-size: 0.8rem;
}

.wiring-template-editor .form-grid,
.wiring-project-settings .form-grid {
  margin-top: 12px;
}

.wiring-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 10px;
}

.wiring-footer div {
  min-height: 58px;
  padding: 7px;
  border: 1px solid #243042;
}

.wiring-footer p {
  margin: 5px 0 0;
  color: var(--ink);
  font-size: 0.72rem;
  line-height: 1.35;
}

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

  .wiring-page-list {
    position: static;
    max-height: none;
  }

  .wiring-sheet {
    aspect-ratio: auto;
  }

  .wiring-main,
  .wiring-project-grid,
  .wiring-footer {
    grid-template-columns: 1fr;
  }

  .wiring-project-grid div,
  .wiring-project-grid div:nth-child(3n) {
    border-right: 0;
  }
}

@media print {
  body {
    background: white;
  }

  .no-print,
  .toast,
  .sync-status {
    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;
  }
}
