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

.app-version {
  display: inline-flex;
  align-items: center;
  align-self: center;
  min-height: 34px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  white-space: nowrap;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 720px;
}

.side-menu {
  display: grid;
  grid-template-rows: auto 1fr;
  align-content: start;
  gap: 14px;
  padding: 14px;
  border-right: 1px solid var(--line);
  background: #f3f5f7;
}

.side-context {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.side-context div {
  display: grid;
  gap: 2px;
}

.side-context span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.side-context strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-content {
  min-width: 0;
}

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

.side-tabs {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 12px;
  border-bottom: 0;
}

.nav-section {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.nav-section summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border: 0;
  background: #e8eef0;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 900;
  list-style: none;
}

.nav-section summary::-webkit-details-marker {
  display: none;
}

.nav-section summary::after {
  content: "⌄";
  color: var(--muted);
  font-size: 0.82rem;
  transition: transform 0.16s ease;
}

.nav-section[open] summary {
  border-bottom: 1px solid #c8d3d8;
}

.nav-section[open] summary::after {
  transform: rotate(180deg);
}

.nav-section .tab {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 36px;
  justify-content: flex-start;
  padding: 0 12px 0 16px;
  border: 0;
  border-radius: 0;
  background: white;
  text-align: left;
}

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

.side-tabs .tab.active {
  border-left: 3px solid #d5a400;
  background: #fff7cf;
}

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

.quote-title-actions, .quote-extra-actions {
  display: flex;
  flex: 0 0 100%;
  gap: 8px;
  flex-wrap: wrap;
}

.quote-extra-actions { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,1.2fr) minmax(0,.65fr); }
.quote-insert-area .group-toolbar { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.6fr) auto; }
.quote-insert-area .group-toolbar > label { min-width: 0; }
.quote-insert-area .group-toolbar > label.wide { grid-column: auto; }
.quote-title-actions { flex: 0 1 auto; flex-wrap: nowrap; }
.quote-title-actions .button { padding: 8px; font-size: 12px; }
.quote-extra-actions { grid-column: 1 / -1; }
@media (max-width: 700px) {
  .quote-insert-area .group-toolbar { grid-template-columns: minmax(0,1fr); }
}
.catalog-management { margin-bottom: 12px; }
.catalog-management > summary { cursor: pointer; font-size: 13px; padding: 8px 0; }
#catalogEditor { margin: 12px 0; }
#catalogEditor[hidden] { display: none; }
.quote-extra-actions .button { padding: 8px 6px; font-size: 12px; min-width: 0; white-space: normal; overflow-wrap: anywhere; }

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

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

.project-panel-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(320px, 1.4fr);
  gap: 14px;
  align-items: start;
}

.project-panel-list,
.project-panel-report {
  display: grid;
  gap: 10px;
}

.project-panel-editor,
.project-panel-report-card,
.project-panel-total {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.project-panel-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.project-panel-row input,
.project-panel-assignment select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 9px;
  background: white;
}

.project-panel-row span,
.project-panel-assignment span,
.project-panel-total span,
.project-panel-report-card header span {
  color: var(--muted);
  font-size: 0.82rem;
}

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

.project-panel-report-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.project-panel-report-card h3 {
  margin: 0;
  font-size: 1rem;
}

.project-panel-insert-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.project-panel-report-stats,
.project-panel-actuator-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-panel-report-stats span,
.project-panel-actuator-list span {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafb;
  font-size: 0.78rem;
}

.project-panel-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.project-panel-mini-table th,
.project-panel-mini-table td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.project-panel-mini-table th {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.project-panel-proposal-table input {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 7px;
  background: white;
}

.project-panel-proposal-table td:first-child {
  width: 64px;
}

.project-panel-proposal-table td:nth-child(2) {
  width: 120px;
}

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

.project-panel-extra-btn {
  justify-self: start;
  min-width: 38px;
  min-height: 32px;
  padding: 0 12px;
  font-weight: 900;
}

.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-list-presets {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.floorplan-list-presets label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
}

.floorplan-list-presets select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
}

.floorplan-list-preset-actions {
  display: flex;
  gap: 5px;
}

.floorplan-list-preset-actions .button {
  min-width: 34px;
  min-height: 34px;
  padding: 0 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; }

@media (min-width: 760px) {
  body[data-active-tab="floorplan"] .editor {
    overflow: visible;
  }

  .floorplan-sidebar {
    position: -webkit-sticky;
    position: sticky;
    top: 10px;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding-right: 3px;
  }

  .floorplan-palette.sticky-palette {
    box-shadow: 0 8px 24px rgba(24, 33, 47, 0.14);
  }
}

.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;
  align-self: start;
  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-media img {
  object-position: center top;
}

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

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

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

.supervision-toolbar label {
  display: grid;
  gap: 5px;
  min-width: min(280px, 100%);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.supervision-toolbar select,
.supervision-toolbar input {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: white;
  color: var(--ink);
}

.supervision-toolbar .supervision-port-field {
  min-width: 92px;
  width: 92px;
}

.supervision-toolbar .supervision-format-field {
  min-width: 170px;
}

.supervision-live-check {
  min-width: auto;
  display: flex !important;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 7px !important;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink) !important;
}

.supervision-live-check input {
  width: 16px;
  min-height: auto;
  padding: 0;
}

.supervision-status {
  align-self: center;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef3f5;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.supervision-status.ok {
  background: #e7f7ed;
  color: #217346;
}

.supervision-status.error {
  background: #fdecec;
  color: #a33b37;
}

.supervision-floor-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.supervision-floor-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-weight: 850;
}

.supervision-floor-button.active {
  border-color: var(--accent-dark);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

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

.supervision-page.controls-collapsed .supervision-grid,
.supervision-page.controls-expanded .supervision-grid {
  grid-template-columns: minmax(0, 1fr);
}

.supervision-page.controls-collapsed .supervision-side,
.supervision-page.controls-expanded .supervision-side {
  order: -1;
}

.supervision-page.controls-collapsed .supervision-light-list {
  display: none;
}

.supervision-page.controls-expanded .supervision-light-list {
  max-height: none;
}

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

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

.supervision-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
}
.supervision-board [hidden] { display: none !important; }
.supervision-imported-marker { min-height:24px; padding:2px 4px; gap:2px; grid-template-columns:16px auto; }
.supervision-imported-marker b { font-size:9px; font-weight:600; max-width:85px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.supervision-placement-status { color:#236747; font-size:11px; }
.supervision-selected { outline:3px solid #126bba; outline-offset:2px; }

.supervision-marker {
  position: absolute;
  display: grid;
  grid-template-columns: 22px auto;
  gap: 5px;
  align-items: center;
  min-height: 34px;
  border: 2px solid #a47a13;
  border-radius: 999px;
  padding: 4px 9px 4px 6px;
  background: #fff1bd;
  color: #6c4b02;
  box-shadow: 0 6px 16px rgba(21, 36, 49, 0.2);
  cursor: pointer;
  transform: translate(-50%, -50%);
  font-weight: 950;
}

.supervision-marker.active {
  border-color: #d5a10f;
  background: #ffd95f;
  color: #392700;
  box-shadow: 0 0 0 4px rgba(255, 217, 95, 0.32), 0 6px 18px rgba(21, 36, 49, 0.22);
}

.supervision-marker.supervision-light-dimmer,
.supervision-marker.supervision-light-010v,
.supervision-marker.supervision-light-dali {
  border-color: #b68a18;
  background: #fff4cb;
}

.supervision-marker.supervision-motor-shutter,
.supervision-marker.supervision-motor-awning,
.supervision-marker.supervision-motor-velux {
  border-color: #7d674b;
  background: #f7ead9;
  color: #493620;
}

.supervision-marker.supervision-vario-onoff,
.supervision-marker.supervision-climate-valve {
  border-color: #7f9a8e;
  background: #edf8f2;
  color: #244f3a;
}

.supervision-light-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 50% 50% 45% 45%;
  background: rgba(255, 255, 255, 0.35);
}

.supervision-light-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: -6px;
  height: 5px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 4px 4px;
  background: rgba(255, 255, 255, 0.28);
}

.supervision-control-icon {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  font-size: 0.55rem;
  font-weight: 950;
  line-height: 1;
}

.supervision-side {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.supervision-light-list {
  display: grid;
  gap: 9px;
  max-height: 720px;
  overflow: auto;
}

.supervision-page.controls-expanded .supervision-light-list {
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
}

.supervision-light-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
  align-items: end;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.supervision-control-row {
  grid-template-columns: 94px minmax(150px, 1fr) minmax(110px, 0.8fr) minmax(110px, 0.8fr);
}

.supervision-light-test {
  display: grid;
  grid-row: span 2;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-height: 38px;
  border: 1px solid #d9bf68;
  border-radius: 8px;
  background: #fff7db;
  color: #6c4b02;
  cursor: pointer;
  font-weight: 950;
}

.supervision-light-test small {
  grid-column: 1 / -1;
  color: inherit;
  font-size: 0.64rem;
  font-weight: 750;
  opacity: 0.74;
}

.supervision-light-test.active {
  border-color: #d5a10f;
  background: #ffd95f;
  color: #392700;
}

.supervision-light-row label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.supervision-light-row input {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 8px;
  background: white;
  color: var(--ink);
}

.supervision-slider {
  align-self: stretch;
}

.supervision-slider span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.supervision-slider input[type="range"] {
  padding: 0;
}

.supervision-motion-buttons {
  display: flex;
  gap: 5px;
  align-self: end;
}

.supervision-motion-buttons button {
  flex: 1;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 900;
}

.supervision-motion-buttons button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.supervision-software-section {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 2px solid var(--line);
}

.supervision-software-title,
.supervision-software-zone > h4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
}

.supervision-software-title h3,
.supervision-software-zone > h4 {
  margin: 0;
  font-size: 0.9rem;
}

.supervision-software-title span {
  min-width: 28px;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 900;
}

.supervision-software-zone {
  display: grid;
  gap: 7px;
}

.supervision-software-zone > h4 {
  border-bottom: 1px solid var(--line);
  padding-bottom: 5px;
  color: var(--muted);
}

.supervision-software-zone > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 9px;
}

.supervision-software-object {
  display: grid;
  gap: 9px;
  align-content: start;
  border: 1px solid var(--line);
  border-left: 4px solid #7e8d99;
  border-radius: 8px;
  padding: 10px;
  background: #f8fafb;
}

.supervision-software-object[draggable="true"] {
  cursor: grab;
}

.supervision-software-object[draggable="true"]:active {
  cursor: grabbing;
}

.supervision-imported-marker {
  min-width: 46px;
  max-width: 120px;
}

.side-tabs .tab.archive-nav {
  color: var(--ink);
  font-weight: 850;
  background: white;
  border-left-color: transparent;
}

.side-tabs .tab.archive-nav.active {
  color: var(--ink);
  background: #fff7cf;
  border-left-color: #d5a400;
}

.quote-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fa;
}

.quote-page-actions .button {
  min-height: 38px;
}

.package-new-button {
  flex: 0 0 42px;
  min-height: 42px;
  border-color: #d5a400;
  background: #fff7cf;
  color: var(--ink);
  font-size: 1.25rem;
}

.package-composer-dialog {
  max-width: min(1460px, calc(100vw - 20px));
}

.package-composer-dialog .modal-content {
  width: min(1420px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  overflow: auto;
}

.package-composer-head,
.package-composer-head > div,
.package-composer-preview-panel,
.package-composer-components {
  display: grid;
  gap: 10px;
}

.package-composer-head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.package-composer-head h2,
.package-composer-head p,
.package-composer-preview-panel h3 {
  margin: 0;
}

.package-composer-meta {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.2fr);
  gap: 10px;
  margin: 16px 0;
}

.package-composer-meta label,
.package-component-picker label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.package-composer-meta input,
.package-component-picker input,
.package-component-picker select,
.package-component-row input,
.package-component-row select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: white;
  color: var(--ink);
}

.package-composer-grid {
  display: grid;
  grid-template-columns: minmax(720px, 1.55fr) minmax(380px, 0.75fr);
  gap: 16px;
}

.package-composer-components,
.package-composer-preview-panel {
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafb;
}

.package-component-picker {
  position: relative;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) 120px 72px auto;
  gap: 8px;
  align-items: end;
}

.package-catalog-results {
  grid-column: 1 / -1;
  display: grid;
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
}

.package-catalog-results:empty {
  display: none;
}

.package-catalog-result {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 7px 9px;
  background: white;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.package-catalog-result:last-child {
  border-bottom: 0;
}

.package-catalog-result:hover,
.package-catalog-result.selected {
  background: var(--accent-soft);
}

.package-catalog-result b,
.package-catalog-result span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.package-component-list {
  display: grid;
  gap: 7px;
  min-width: 0;
  overflow-x: auto;
}

.package-component-row {
  display: grid;
  grid-template-columns: 48px minmax(82px, 0.55fr) minmax(150px, 1.2fr) 116px minmax(150px, 0.85fr) 66px auto;
  gap: 7px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px;
  background: white;
}

.package-component-row.is-spacer {
  border-style: dashed;
  background: #f8fafb;
}

.package-spacer-tools {
  display: flex;
  align-items: end;
  gap: 8px;
}

.package-spacer-tools label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.package-spacer-tools select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 30px 0 10px;
  background: white;
}

.package-component-row select:disabled {
  color: var(--muted);
  background: #f3f5f7;
}

.package-component-row img,
.package-component-image-empty {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 5px;
  background: #eef1f4;
}

.package-component-row code {
  font-weight: 800;
}

.package-component-description {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.package-component-role-static {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.package-component-actions {
  display: flex;
  gap: 3px;
}

.package-component-actions button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  cursor: pointer;
}

.package-component-actions .danger {
  color: var(--danger);
}

.package-composer-preview {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid #cfd7de;
  border-radius: 8px;
  background: white;
}

.package-preview-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.package-preview-modes {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
}

.package-preview-modes button {
  min-height: 30px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 0 10px;
  background: white;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 800;
}

.package-preview-modes button:last-child { border-right: 0; }
.package-preview-modes button.active { background: var(--accent-soft); color: var(--ink); }

.package-scale-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.package-scale-controls label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.package-scale-controls input { grid-column: 1 / -1; width: 100%; }
.package-scale-controls output { color: var(--ink); }

.package-composer-layer {
  position: absolute;
  inset: 8%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.package-composer-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.package-composer-layer-support { z-index: 1; }
.package-composer-layer-fruits { z-index: 2; inset: 24% 20%; gap: 0; }
.package-composer-layer-button-covers { z-index: 3; inset: 22% 18%; gap: 0; }
.package-composer-layer-frame { z-index: 4; }
.package-composer-layer-icons { z-index: 5; inset: 22% 18%; gap: 0; pointer-events: none; }
.package-composer-layer-other { z-index: 6; inset: auto 8% 5%; gap: 5px; }

.package-composer-natural-strip {
  position: absolute;
  inset: 18% 18%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(var(--fruit-scale, 1));
  transform-origin: center;
}

.package-natural-fruit-slot {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  height: 86%;
  aspect-ratio: var(--fruit-aspect, 1) / 1;
  margin: 0 -1px;
}

.package-natural-fruit-slot > img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
}

.package-natural-fruit-slot.is-spacer {
  width: auto;
  aspect-ratio: calc(var(--space-modules, 1) * 0.56) / 1;
  margin: 0;
}

.package-natural-slot-overlay {
  position: absolute;
  inset: -2%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.package-natural-cover {
  position: relative;
  display: grid;
  place-items: center;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
}

.package-natural-cover > img,
.package-natural-direct-icons img,
.package-natural-cover-icons img {
  width: auto;
  max-width: 100%;
  height: 100%;
  object-fit: contain;
}

.package-natural-cover-icons,
.package-natural-direct-icons {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.package-composer-layer-frame {
  transform: scale(var(--frame-scale, 1));
  transform-origin: center;
}

.package-composer-module-layer {
  position: absolute;
  inset: 24% 20%;
  z-index: 2;
}

.package-composer-module-layer.package-composer-layer-button-covers { z-index: 3; }
.package-composer-module-layer.package-composer-layer-icons { z-index: 5; }
.package-composer-module-layer.package-composer-layer-rear { z-index: 2; inset: 21% 17%; }

.package-composer-module-layer img {
  position: absolute;
  top: 0;
  left: var(--module-left);
  width: var(--module-width);
  height: 100%;
  object-fit: contain;
}

.package-composer-layer-fruits img,
.package-composer-layer-button-covers img,
.package-composer-layer-icons img {
  width: auto;
  max-width: calc(100% / var(--component-count));
  height: 78%;
  flex: 0 1 auto;
  margin: 0 -1px;
}

.package-composer-layer-button-covers img { height: 82%; }
.package-composer-layer-icons img { height: 84%; }

.package-composer-module-layer.package-composer-layer-fruits img,
.package-composer-module-layer.package-composer-layer-button-covers img {
  position: absolute;
  top: 0;
  left: var(--module-left);
  width: calc(var(--module-width) + 1px);
  max-width: none;
  height: 100%;
  margin: 0;
  object-fit: fill;
}

.package-composer-module-layer.package-composer-layer-icons img,
.package-composer-module-layer.package-composer-layer-rear img {
  position: absolute;
  top: 0;
  left: var(--module-left);
  width: var(--module-width);
  max-width: none;
  height: 100%;
  margin: 0;
  object-fit: contain;
}

.package-composer-ai-result {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid #cfd7de;
  border-radius: 8px;
  background: white;
}

.package-composer-ai-result[hidden] { display: none; }

.package-composer-ai-result img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.package-composer-ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.package-composer-ai-status:empty { display: none; }

@media (max-width: 1180px) {
  .package-composer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .package-scale-controls { grid-template-columns: 1fr; }
}

.package-composer-placeholder {
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

@media (max-width: 820px) {
  .package-composer-meta,
  .package-composer-grid {
    grid-template-columns: 1fr;
  }

  .package-component-picker,
  .package-component-row {
    grid-template-columns: 1fr 1fr;
  }

  .package-component-search,
  .package-component-description,
  .package-catalog-results {
    grid-column: 1 / -1;
  }
}

.supervision-software-light-onoff,
.supervision-software-light-dimmer {
  border-left-color: #d5a10f;
}

.supervision-software-motor { border-left-color: #866947; }
.supervision-software-valve,
.supervision-software-thermostat { border-left-color: #2e8060; }
.supervision-software-climate-regulator, .supervision-software-fancoil { border-left-color: #2e8060; }
.supervision-software-environment-sensor { border-left-color: #167c89; }
.supervision-marker[data-device-type="climate-regulator"], .supervision-marker[data-device-type="fancoil"] { background: #edf8f2; color: #244f3a; border: 2px solid #2e8060; }
.supervision-marker[data-device-type="environment-sensor"] { background: #e9f7f9; color: #155662; border: 2px solid #167c89; }
.supervision-climate-metrics { display: grid; gap: 6px; width: 100%; }
.supervision-climate-metrics > div { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.supervision-software-energy-meter { border-left-color: #24759b; }

.supervision-software-head {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.supervision-remove-placement {
  width: 32px;
  height: 32px;
  border: 1px solid #dfb5b5;
  border-radius: 4px;
  background: #fff;
  color: #bc2929;
  font-size: 22px;
  cursor: pointer;
}
.supervision-placement-status { color: #246445; font-weight: 700; }
.supervision-marker[data-device-type="motor"] {
  border-color: #866947; background: #f7ead9; color: #493620;
}
.supervision-marker[data-device-type="valve"],
.supervision-marker[data-device-type="thermostat"] {
  border-color: #2e8060; background: #edf8f2; color: #244f3a;
}
.supervision-marker[data-device-type="energy-meter"] {
  border-color: #24759b; background: #e4f2fc; color: #18526d;
}
.supervision-marker[data-device-type].active { box-shadow: 0 0 0 3px currentColor; }

.supervision-software-head > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.supervision-software-head b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supervision-software-head small {
  color: var(--muted);
  font-size: 0.68rem;
}

.supervision-software-controls {
  display: grid;
  gap: 8px;
}

.supervision-readonly-state,
.supervision-thermostat-summary,
.supervision-energy-values {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 7px;
  padding: 8px 10px;
  background: #edf1f3;
  color: var(--muted);
  font-size: 0.75rem;
}

.supervision-readonly-state.active {
  background: #dff4e8;
  color: #165c3e;
}

.supervision-energy-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.supervision-energy-values span {
  display: grid;
  gap: 3px;
}

.supervision-advanced,
.supervision-group-details {
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.supervision-advanced summary,
.supervision-group-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
}

.supervision-advanced[open],
.supervision-group-details[open] {
  display: grid;
  gap: 8px;
}

.supervision-group-details > div {
  display: grid;
  gap: 4px;
}

.supervision-group-details > div > div {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto;
  gap: 7px;
  align-items: center;
  font-size: 0.67rem;
}

.supervision-group-details span,
.supervision-group-details small { color: var(--muted); }

.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="classic"] .quote-sheet { --paper: #fff; background: #fff; }
body[data-template="classic"] .preview-table .product-image { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
body[data-template="classic"] .preview-table .empty-image { visibility: hidden; }
@page quoteCover { size: A4; margin: 0; }
@media print {
  .cover-page { page: quoteCover; width: 210mm !important; height: 297mm !important; min-height: 297mm !important; max-height: 297mm; aspect-ratio: auto; box-sizing: border-box; }
}

body[data-template="classic"] .title-row td {
  background: #fff;
  border-top: 1px solid #cfd8dc;
  border-bottom: 1px solid #edf1f2;
  color: #26353b;
  font-weight: 700;
}

body[data-template="classic"] .title-row strong {
  font-weight: 700;
}

body[data-template="classic"] .group-row td,
body[data-template="classic"] .package-row td {
  background: #fff;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

body[data-template="classic"] .group-row td {
  padding: 9px 7px 6px;
  border-top: 1px solid #aebfc0;
  border-bottom: 1px solid #e5ebeb;
  color: #35575a;
  font-size: 0.82rem;
}

body[data-template="classic"] .package-row td {
  padding: 8px 7px 5px;
  border-top: 1px solid #d4cec2;
  border-bottom: 1px solid #f0ede7;
  color: #625a4d;
  font-size: 0.78rem;
}

body[data-template="classic"] .group-row .line-meta,
body[data-template="classic"] .package-row .line-meta {
  margin-top: 3px;
  color: #7a8589;
  font-size: 0.7rem;
  font-weight: 400;
  line-height: 1.3;
}

body[data-template="classic"] .group-total-row td {
  background: #fff;
  border-top: 1px solid #dce5e5;
  color: #536b6d;
  font-size: 0.76rem;
  font-weight: 700;
}

body[data-template="classic"] .package-end-preview-row td {
  height: 6px;
  border-bottom: 1px solid #ded9cf;
}

body.pdf-document[data-template="classic"] .title-row td {
  padding: 7px 5px 5px;
}

body.pdf-document[data-template="classic"] .group-row td {
  padding: 5px 5px 4px;
  font-size: 0.68rem;
}

body.pdf-document[data-template="classic"] .package-row td {
  padding: 4px 5px 3px;
  font-size: 0.66rem;
}

body.pdf-document[data-template="classic"] .group-row .line-meta,
body.pdf-document[data-template="classic"] .package-row .line-meta {
  font-size: 0.61rem;
}

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

  .project-panel-layout {
    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: start 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;
  object-position: center top;
}

.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: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

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

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

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

.project-archive-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) minmax(220px, 1fr) minmax(170px, 0.75fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid #ead38a;
  border-radius: 8px;
  background: #fffaf0;
}

.project-archive-bar label {
  display: grid;
  gap: 5px;
}

.project-archive-bar label span {
  color: #6b5a18;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.project-name-field input {
  min-height: 42px;
  border-color: #e2c76d;
  background: #fffef8;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 850;
}

.project-client-field input,
.project-picker-field select {
  min-height: 38px;
}

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

.project-icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.project-icon-button:hover {
  border-color: var(--accent);
  background: #f4f7fb;
  transform: translateY(-1px);
}

.project-icon-button.danger {
  border-color: #d65b5b;
  background: #fff5f5;
  color: #b32626;
}

.project-icon-button.danger:hover {
  background: #c83939;
  color: white;
}

.project-archive-actions .button.primary {
  min-height: 38px;
}

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

.project-overview-card {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.project-overview-card .section-title {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafb;
}

.project-overview-list {
  display: grid;
}

.project-overview-row {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: white;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.project-overview-row:last-child {
  border-bottom: 0;
}

.project-overview-row:hover,
.project-overview-row.active {
  background: #fff7cf;
}

.project-overview-row strong {
  font-size: 0.9rem;
}

.project-overview-row span {
  color: var(--muted);
  font-size: 0.8rem;
}

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

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

  .side-menu {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }

  .project-archive-bar {
    grid-template-columns: 1fr;
  }

  .project-archive-actions {
    justify-content: flex-start;
  }

  .project-overview-grid {
    grid-template-columns: 1fr;
  }
}

.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-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.byme-missing-details > summary::-webkit-details-marker {
  display: none;
}

.byme-missing-details > summary::after {
  content: "▾";
  color: var(--muted);
  font-size: 0.74rem;
}

.byme-missing-details:not([open]) > summary::after {
  transform: rotate(-90deg);
}

.byme-missing-details > summary span {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e9eff1;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
}

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

.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,
.software-archive-panel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

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

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

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

.software-archive-list {
  margin-top: 12px;
}

.address-page {
  align-content: start;
}

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

.address-summary article {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

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

.address-summary article strong {
  font-size: 1.55rem;
  line-height: 1;
}

.address-summary article em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
}

.address-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.address-tools .button.active {
  border-color: #f0b429;
  background: #fff4cc;
  color: #6f3b00;
}

.transfer-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.transfer-button > span[aria-hidden="true"] {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, currentColor 12%, transparent);
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1;
}

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

.address-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.address-panel .section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafb;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.address-panel .section-title::-webkit-details-marker {
  display: none;
}

.address-panel .section-title::after {
  content: "▾";
  margin-left: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.address-panel:not([open]) .section-title {
  border-bottom: 0;
}

.address-panel:not([open]) .section-title::after {
  transform: rotate(-90deg);
}

.address-panel .section-title h2 {
  flex: 1;
  margin: 0;
}

.address-panel .section-title span {
  min-width: 30px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e9eff1;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-align: center;
}

.address-filter-row {
  padding: 9px 10px 0;
  background: #ffffff;
}

.address-filter-row input {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

.address-filter-row input:focus {
  border-color: #1a7778;
  outline: 2px solid rgba(26, 119, 120, 0.14);
}

.address-panel > .table-wrap {
  max-height: min(58vh, 620px);
  overflow: auto;
  overscroll-behavior: contain;
}

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

.address-table th,
.address-table td {
  padding: 8px 9px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.3;
  text-align: left;
  vertical-align: top;
}

.address-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef4f5;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.table-sort-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
}

.table-sort-button:hover {
  color: var(--ink);
}

.address-table td:nth-child(1),
.address-table td:nth-child(2),
.address-table td:nth-child(3),
.address-table td:nth-child(4) {
  white-space: nowrap;
}

.address-table small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
}

.address-conflict {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #ffe0db;
  color: #a52d22;
  font-size: 0.68rem;
  font-weight: 850;
  white-space: nowrap;
}

.address-table tr.has-conflict.conflict {
  background: #fff4f2;
}

.address-table tr.has-conflict.warning {
  background: #fff9e8;
}

.address-table tr.has-conflict.aligned {
  background: #eefbf2;
}

.address-conflict.conflict {
  background: #ffd6d1;
  color: #9f1d16;
}

.address-conflict.warning {
  background: #fff1bf;
  color: #7a4d00;
}

.address-conflict.aligned {
  background: #cdeed8;
  color: #1f6b3a;
}

.side-tabs .tab[data-update-count]:not([data-update-count="0"])::after {
  content: attr(data-update-count);
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: auto;
  padding: 0 5px;
  border-radius: 9px;
  background: #e24a3b;
  color: #fff;
  font-size: 0.64rem;
  font-weight: 850;
}

.software-transfer-actions {
  align-items: center;
}

.software-page-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--line);
}

.software-zone-filter {
  display: grid;
  gap: 4px;
  min-width: 210px;
  margin-left: auto;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.software-zone-filter select {
  min-height: 36px;
}

.address-resolution-choice {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  font-size: 0.67rem;
  font-weight: 750;
  color: var(--muted);
  cursor: pointer;
}

.address-resolution-choice input {
  margin: 0;
}

.address-table tr.has-conflict.resolved,
.address-table tr.has-conflict.warning.resolved,
.address-table tr.has-conflict.conflict.resolved {
  background: #eefbf2;
}

.address-panel .section-title > .compact-button {
  margin-left: auto;
}

.byme-log-date {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #f7f9fb;
}

.byme-log-date span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  text-transform: uppercase;
}

.byme-log-table {
  min-width: 1120px;
  font-size: 0.74rem;
}

.byme-log-table th,
.byme-log-table td {
  padding: 7px 8px;
  vertical-align: top;
}

.byme-log-time,
.byme-log-address,
.byme-log-value,
.byme-log-dpt {
  white-space: nowrap;
}

.byme-log-time strong,
.byme-log-address strong,
.byme-log-value strong,
.byme-log-address small,
.byme-log-value small,
.byme-log-time small {
  display: block;
}

.byme-log-table small,
.byme-log-table .muted {
  color: var(--muted);
  font-size: 0.66rem;
}

.byme-log-description span,
.byme-log-dpt span {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 5px;
  max-width: 330px;
  white-space: normal;
}

.byme-log-description b,
.byme-log-dpt b {
  color: var(--muted);
  font-size: 0.62rem;
  text-transform: uppercase;
}

.byme-log-conflict {
  background: #fff3f1;
}

.byme-log-raw summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
}

.byme-log-raw code {
  display: block;
  width: 300px;
  margin-top: 5px;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .software-zone-filter {
    width: 100%;
    margin-left: 0;
  }
}

.ets-export-dialog .modal-content {
  width: min(960px, calc(100vw - 32px));
}

.ets-export-conflicts {
  max-height: min(52vh, 520px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.warning-hint {
  padding: 10px 12px;
  border-left: 3px solid #d89b00;
  background: #fff8df;
  color: #654600;
}

.ets-conflict-table {
  min-width: 720px;
}

.connections-page {
  align-content: start;
}

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

.connections-toolbar label {
  display: grid;
  gap: 5px;
  min-width: min(300px, 100%);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.connections-toolbar select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: #ffffff;
  color: var(--ink);
}

.connections-toolbar > span {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.connections-table-wrap {
  max-height: 680px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

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

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

.connections-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef4f5;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.connections-table select,
.connections-table input {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.76rem;
}

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

.software-archive-table,
.wiring-network-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.software-archive-table th,
.software-archive-table td,
.wiring-network-table th,
.wiring-network-table td {
  padding: 7px 8px;
  border: 1px solid #d8dde6;
  font-size: 0.76rem;
  line-height: 1.3;
  text-align: left;
  vertical-align: top;
}

.software-archive-table th,
.wiring-network-table th {
  background: #f4f6f8;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

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

.wiring-network-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #243042;
}

.wiring-network-top p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-align: right;
  text-transform: uppercase;
}

.wiring-network-top > div:last-child strong {
  display: block;
  text-align: right;
}

.wiring-network-title {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  border: 1px solid #243042;
}

.wiring-network-title div {
  min-height: 42px;
  padding: 6px 8px;
}

.wiring-network-title div + div {
  border-left: 1px solid #243042;
}

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

.wiring-network-title strong {
  display: block;
  margin-top: 3px;
  font-size: 0.8rem;
}

.wiring-network-table {
  align-self: start;
}

.wiring-network-table th,
.wiring-network-table td {
  border-color: #243042;
  font-size: 0.7rem;
}

.wiring-network-table th:nth-child(1) {
  width: 14%;
}

.wiring-network-table th:nth-child(2) {
  width: 8%;
}

.wiring-network-table th:nth-child(5),
.wiring-network-table th:nth-child(6) {
  width: 12%;
}

.wiring-network-table th:nth-child(7) {
  width: 14%;
}

.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) {
  .supervision-grid {
    grid-template-columns: 1fr;
  }

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

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

  .supervision-light-test {
    grid-row: auto;
  }

  .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[data-active-tab="quote"]:not([data-view="floorplan-print"]) .preview { display: block !important; }
  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 {
    page: floorplan-landscape;
    display: block !important;
  }
  @page floorplan-landscape { size: A4 landscape; margin: 10mm; }
  @page floorplan-portrait { size: A4 portrait; margin: 10mm; }
  body[data-view="floorplan-print"] .floorplan-print-sheet[data-orientation="portrait"] {page:floorplan-portrait;}
  body[data-view="floorplan-print"] .floorplan-print-sheet[data-orientation="portrait"] .floorplan-print-page {min-height:277mm;}
  body[data-view="floorplan-print"] .floorplan-print-sheet[data-orientation="portrait"] .floorplan-print-map-page {height:277mm;}
  .floorplan-cover-title h1 {font-size:30pt;font-weight:400;line-height:1.2;}
  .floorplan-cover-title h2 {font-size:14pt;font-weight:400;color:#596168;line-height:1.5;}
  .floorplan-cover-title p {font-size:10pt;font-weight:400;color:#596168;}
  .floorplan-print-row h3 {font-size:11pt;font-weight:500;}
  .floorplan-print-row p {font-size:9pt;color:#596168;}
  .floorplan-print-legend-section h2,.floorplan-print-page h2 {font-size:14pt;font-weight:500;}
  .floorplan-print-table th {font-size:9pt;font-weight:500;background:#f7f8f8;}
  .floorplan-print-table td {font-size:9pt;}
  body[data-view="floorplan-print"] .floorplan-print-cover { min-height: 190mm; }
  body[data-view="floorplan-print"] .floorplan-cover-title { margin: 35mm 14mm 25mm; }

  body[data-view="floorplan-print"] .floorplan-print-page {
    width: 100%;
    min-height: 190mm;
    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: 190mm;
    overflow: hidden;
  }

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

  body[data-view="floorplan-print"] .floorplan-print-plan {
    max-width: 277mm;
  }

  body[data-view="floorplan-print"] .floorplan-print-board {
    border: 0;
  }
}
 .byme-prototype-report {
  margin-top: 16px;
  padding: 12px;
  border-left: 3px solid #b8860b;
  background: #fff9e8;
  max-height: 240px;
  overflow: auto;
  overflow-wrap: anywhere;
  font-size: 14px;
}
/* Closed workspaces retain archive data but never show stale functional views. */
body[data-quote-open="false"] :is(#quoteTab, #finishTab) > :not(.closed-context),
body[data-project-open="false"] :is(#floorplanTab, #panelsTab) > :not(.closed-context),
body[data-software-open="false"] :is(#documentsTab, #sensorsTab, #connectionsTab, #addressesTab, #supervisionTab) > :not(.closed-context) { display: none !important; }
.closed-context { padding: 24px 0; }
.closed-context[hidden], .context-close[hidden] { display: none !important; }
.closed-context button { margin: 8px 8px 0 0; }
.side-context > div { position: relative; padding-right: 28px; }
.context-close { position: absolute; right: 0; top: 8px; border: 0; background: transparent; color: #bd2525; font-size: 20px; cursor: pointer; }
.context-close-dialog { max-width: min(580px, 92vw); border: 1px solid #ccd2d6; border-radius: 8px; }
.context-close-dialog::backdrop { background: #0006; }
.quote-spacer td { height: 7mm; padding: 0 !important; border: 0 !important; }
.quote-page-break td { padding: 0 !important; border: 0 !important; height: 0; }
#catalogTab .catalog-filter { padding: 10px 12px; background: #edf8f8; border-left: 3px solid var(--accent); border-radius: 4px; }
#catalogTab .catalog-filter input { border-color: #7ab7bc; }
.package-new-button { background: var(--accent); color: #fff; border-color: var(--accent); }
.package-new-button:hover { filter: brightness(0.92); }
.package-card-actions { grid-template-columns: 22px 32px minmax(44px, 1fr) 36px 36px; gap:6px; align-items: end; }
.package-edit-icon { width:32px; height:40px; padding:0; font-size:22px; }
.package-card-actions .package-insert-icon {width:36px;}
.package-source-icon { align-self:center; filter:grayscale(1); opacity:.35; font-size:20px; }
.package-source-icon.headquarters { filter:none; opacity:1; }
.package-insert-icon { width: 40px; height: 40px; padding: 0; font-size: 24px; line-height: 1; }
.sync-status { width: auto; gap: 9px; border-radius: 0; }
@media screen {
  body:is([data-active-tab="project"], [data-active-tab="softwareArchive"], [data-active-tab="customers"]) .workspace { grid-template-columns: minmax(0, 1fr); }
  body:is([data-active-tab="project"], [data-active-tab="softwareArchive"], [data-active-tab="customers"]) .preview { display: none; }
  #projectTab .project-archive-bar, #softwareArchiveTab .project-archive-bar { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); background: #f5f8f8; border-color: #d5dfe1; }
  .context-archive-row > div:first-child { min-width: 0; overflow-wrap: anywhere; }
  body[data-active-tab="connections"] .workspace { grid-template-columns: minmax(0, 1fr); }
  body[data-active-tab="connections"] .preview { display: none; }
  .connections-table { min-width: 1000px; }
  .connections-table th:first-child { width: 300px; }
  .connections-table th:last-child { width: 48px; }
  .connections-table td:first-child select + select { margin-top: 6px; }
  .connections-table small { display: block; margin-top: 5px; }
}
@media print { .quote-page-break { break-before: page; page-break-before: always; } }
@media screen and (max-width: 640px) {
  .header-actions { display: flex; flex-wrap: wrap; min-width: 0; }
  .side-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side-tabs .tab, .nav-section summary { white-space: normal; overflow-wrap: anywhere; }
  .ui-language-picker { flex-wrap: wrap; min-width: 0; }
}
.context-archive-list { margin: 16px 0; border-top: 1px solid #d5dfe1; }
.context-archive-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 8px; border-bottom: 1px solid #d5dfe1; }
.context-archive-row.active { background: #edf6f6; }
.context-archive-row small { display: block; color: #58666d; }
.context-archive-actions { display: flex; gap: 6px; flex-shrink: 0; }
.customer-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 18px 0; }
#customerForm[hidden] { display: none !important; }
#projectTab [hidden], #softwareArchiveTab [hidden] { display: none !important; }
@media (max-width: 640px) { .context-archive-row { align-items: flex-start; flex-direction: column; } }
.user-session-menu { position:relative; }
.user-session-menu summary { cursor:pointer; padding:8px 12px; font-weight:600; }
.user-session-menu[open] #logoutBtn { position:absolute; right:0; top:100%; z-index:50; min-width:120px; background:white; }
#composerDetails92 { padding:12px 0; border-bottom:1px solid #d8dee6; margin-bottom:12px; }
#composerDetails92 summary { cursor:pointer; font-weight:600; margin-bottom:10px; }
.unassigned-catalog-dialog { width: min(1100px, calc(100vw - 32px)); max-height: 85vh; padding: 20px; border: 1px solid #ccd7df; border-radius: 8px; background: #fff; color: #192331; box-sizing: border-box; }
.unassigned-catalog-dialog[open] { display: flex; flex-direction: column; gap: 16px; }
.unassigned-catalog-dialog::backdrop { background: rgb(0 0 0 / 35%); }
.unassigned-catalog-dialog header, .unassigned-catalog-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.unassigned-catalog-dialog h2 { margin: 0; font-size: 20px; overflow-wrap: anywhere; }
.unassigned-catalog-dialog header h2 { flex: 1; }
.unassigned-catalog-toolbar { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.unassigned-catalog-toolbar label { flex: 1 1 220px; min-width: 0; }
.unassigned-catalog-table { overflow: auto; min-height: 100px; max-height: 50vh; border-block: 1px solid #dbe3e8; }
.unassigned-catalog-table table { width: 100%; min-width: 580px; table-layout: fixed; }
.unassigned-catalog-table th { position: sticky; top: 0; background: #edf3f5; z-index: 1; }
.unassigned-catalog-table th, .unassigned-catalog-table td { padding: 10px; text-align: left; vertical-align: top; overflow-wrap: anywhere; white-space: normal; }
.unassigned-catalog-table th:nth-child(1) { width: 17%; }
.unassigned-catalog-table th:nth-child(2) { width: 42%; }
.unassigned-catalog-table th:nth-child(3) { width: 15%; }
.unassigned-catalog-table td { border-bottom: 1px solid #edf0f2; }
.unassigned-catalog-dialog footer > div { display: flex; gap: 8px; }
.unassigned-catalog-dialog header button, .unassigned-catalog-dialog footer button { width: 42px; height: 42px; padding: 0; flex: 0 0 42px; }
@media (max-width: 600px) { .unassigned-catalog-dialog { padding: 12px; } .unassigned-catalog-dialog h2 { font-size: 18px; } }
.catalog-status-label {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: #596775;
}
/* Hidden also in printed clones; the policy is enforced separately on the server. */
.privacy-hidden { display: none !important; }
