:root {
  --ink: #1e2725;
  --muted: #687773;
  --paper: #eef2ef;
  --panel: #ffffff;
  --line: #d9e2dd;
  --accent: #10a37f;
  --accent-dark: #08745d;
  --orange: #d85f36;
  --blue: #2d608f;
  --yellow: #f5c84c;
  --soft: #e6f2ed;
  --soft-blue: #e7eef7;
  --danger: #ffe7df;
  --shadow: 0 18px 42px rgba(23, 37, 33, 0.1);
  --toolbar: 64px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% 20%, rgba(16, 163, 127, 0.12), transparent 34%),
    linear-gradient(135deg, rgba(45, 96, 143, 0.08), transparent 36%),
    var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button,
.file-btn {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

button:hover,
.file-btn:hover {
  border-color: var(--accent);
}

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

button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

button.wide {
  width: 100%;
}

.account-topbar {
  position: fixed;
  top: 10px;
  right: 12px;
  z-index: 200;
}

.account-topbar[hidden] {
  display: none;
}

.account-topbar-card,
.account-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.account-topbar-identity {
  display: grid;
  min-width: 92px;
  max-width: 170px;
  gap: 1px;
  padding: 0 8px;
  text-align: right;
}

.account-topbar-identity strong,
.account-topbar-identity span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-topbar-identity strong {
  font-size: 0.86rem;
}

.account-topbar-identity span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.account-topbar button {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 0.86rem;
}

.tool-button.icon-only {
  position: relative;
  width: 38px;
  min-width: 38px;
  padding: 0;
  isolation: isolate;
}

.tool-button.icon-only svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.tool-button.danger-tool {
  color: #9f1239;
}

.tool-button[data-tooltip]::after,
.tool-button[data-tooltip]::before {
  position: absolute;
  left: 50%;
  top: calc(100% + 9px);
  bottom: auto;
  transform: translateX(-50%) translateY(-4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 30;
}

.tool-button[data-tooltip]::after {
  content: attr(data-tooltip);
  width: max-content;
  max-width: 220px;
  padding: 7px 9px;
  border-radius: 7px;
  background: #172521;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  box-shadow: 0 12px 30px rgba(23, 37, 33, 0.18);
}

.tool-button[data-tooltip]::before {
  content: "";
  top: calc(100% + 4px);
  bottom: auto;
  width: 9px;
  height: 9px;
  background: #172521;
  transform: translateX(-50%) rotate(45deg);
}

.tool-button[data-tooltip]:hover::after,
.tool-button[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tool-button[data-tooltip]:hover::before,
.tool-button[data-tooltip]:focus-visible::before {
  opacity: 1;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
}

h2 {
  margin-bottom: 12px;
  font-size: 1.05rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 0.98rem;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.public-auth-screen {
  min-height: 100vh;
  padding: clamp(18px, 4vw, 52px);
  background:
    linear-gradient(135deg, rgba(16, 163, 127, 0.10), rgba(255, 255, 255, 0) 38%),
    linear-gradient(225deg, rgba(45, 96, 143, 0.12), rgba(255, 255, 255, 0) 42%),
    #f6f8f6;
}

.public-auth-screen.active {
  display: block;
}

.public-shell {
  width: min(1160px, 100%);
  margin: 0 auto;
}

.public-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: clamp(30px, 5vw, 74px);
}

.public-topbar nav,
.public-actions,
.auth-actions,
.auth-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-button {
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  font-size: 1.08rem;
}

.public-hero {
  display: grid;
  grid-template-columns: minmax(280px, 0.92fr) minmax(320px, 1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}

.public-lead {
  max-width: 620px;
  color: #34423e;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  line-height: 1.45;
}

.public-preview {
  display: grid;
  gap: 14px;
}

.preview-plan {
  position: relative;
  min-height: 330px;
  border: 1px solid #cfd9d5;
  border-radius: 8px;
  background:
    linear-gradient(#e6ece9 1px, transparent 1px),
    linear-gradient(90deg, #e6ece9 1px, transparent 1px),
    #fff;
  background-size: 28px 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.preview-room,
.preview-item,
.preview-cable {
  position: absolute;
  display: block;
}

.preview-room {
  border: 2px solid #2d608f;
  background: rgba(231, 238, 247, 0.74);
  color: #263f59;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 8px;
}

.preview-room.room-a { left: 8%; top: 11%; width: 46%; height: 42%; }
.preview-room.room-b { left: 57%; top: 11%; width: 34%; height: 42%; }
.preview-room.room-c { left: 18%; top: 58%; width: 56%; height: 28%; }

.preview-item {
  width: 16px;
  height: 16px;
  border: 3px solid #10a37f;
  border-radius: 50%;
  background: #fff;
  z-index: 2;
}

.preview-item.item-a { left: 30%; top: 38%; }
.preview-item.item-b { left: 72%; top: 35%; }
.preview-item.item-c { left: 45%; top: 72%; }

.preview-cable {
  height: 3px;
  border-radius: 999px;
  background: #d85f36;
  transform-origin: left center;
}

.preview-cable.cable-a { left: 32%; top: 41%; width: 42%; transform: rotate(-4deg); }
.preview-cable.cable-b { left: 47%; top: 73%; width: 30%; transform: rotate(-62deg); }

.preview-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #d9e2dd;
  border-radius: 8px;
  background: #fff;
  padding: 14px 16px;
  color: var(--muted);
}

.preview-summary strong {
  color: var(--ink);
}

.public-feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: clamp(34px, 6vw, 76px);
}

.public-feature-grid article,
.auth-card {
  border: 1px solid #d9e2dd;
  border-radius: 8px;
  background: #fff;
  padding: 20px;
  box-shadow: 0 12px 30px rgba(23, 37, 33, 0.07);
}

.public-feature-grid p {
  color: var(--muted);
  line-height: 1.45;
}

.auth-card {
  max-width: 520px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.offer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.offer-grid article {
  border: 1px solid #d9e2dd;
  border-radius: 8px;
  padding: 12px;
  background: #f8faf9;
}

.offer-grid h2 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.offer-grid p {
  margin: 0;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-links button {
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  padding: 4px 0;
  min-height: 0;
}

.auth-message {
  width: min(720px, 100%);
  margin: 0 auto 18px;
  border: 1px solid #cbd5d1;
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
  color: #263f59;
  font-weight: 800;
}

.project-screen {
  min-height: 100vh;
  display: none;
  place-items: center;
  padding: clamp(22px, 4vw, 58px);
}

@media (max-width: 860px) {
  .public-hero,
  .project-shell {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .account-topbar {
    left: 10px;
    right: 10px;
  }

  .account-topbar-card,
  .account-topbar-actions {
    justify-content: stretch;
  }

  .account-topbar-card {
    flex-wrap: wrap;
  }

  .account-topbar-actions button,
  .account-topbar-card button {
    flex: 1 1 auto;
  }

  .account-topbar-identity {
    flex: 1 1 100%;
    max-width: none;
    text-align: left;
  }

  .public-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .public-feature-grid {
    grid-template-columns: 1fr;
  }

  .preview-plan {
    min-height: 260px;
  }
}

.project-screen.active {
  display: grid;
}

.project-shell {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 500px);
  gap: clamp(28px, 5vw, 74px);
  align-items: center;
  width: min(1120px, 100%);
}

.hero {
  max-width: 560px;
}

.hero p:not(.eyebrow) {
  max-width: 520px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
}

.hero h1 {
  margin-bottom: 8px;
  font-size: clamp(2.3rem, 5vw, 4rem);
  line-height: 0.98;
}

.hero-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.hero-steps span {
  padding: 7px 10px;
  border: 1px solid rgba(16, 163, 127, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #31423d;
  font-size: 0.8rem;
  font-weight: 900;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 0.77rem;
  font-weight: 900;
  text-transform: uppercase;
}

.start-card,
.room-row,
.palette,
.inspector,
.canvas-zone,
.print-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.pdf-report {
  display: none;
}

.pdf-page {
  background: #fff;
  color: #172521;
}

.pdf-cover {
  display: grid;
  align-content: center;
  min-height: 270mm;
  padding: 28mm;
  border: 8px solid #16251f;
}

.pdf-cover-mark {
  width: fit-content;
  margin-bottom: 18mm;
  padding: 7px 12px;
  border: 1px solid #10a37f;
  color: #08745d;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.pdf-cover h1 {
  max-width: 190mm;
  margin-bottom: 8px;
  font-size: 2.4rem;
  line-height: 1.08;
}

.pdf-cover > p {
  margin-bottom: 20mm;
  color: #53605d;
  font-size: 1.05rem;
}

.pdf-cover-grid,
.pdf-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12mm;
}

.pdf-cover-grid span,
.pdf-metrics span {
  display: grid;
  gap: 6px;
  min-height: 22mm;
  padding: 10px;
  border: 1px solid #d9e2dd;
  border-radius: 6px;
}

.pdf-cover-grid strong,
.pdf-metrics strong {
  color: #172521;
  font-size: 1rem;
}

.pdf-warning-box {
  padding: 14px 16px;
  border-left: 5px solid #10a37f;
  background: #f4faf7;
}

.pdf-warning-box p {
  margin: 5px 0;
  color: #53605d;
}

.pdf-page-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 8mm;
  padding-bottom: 4mm;
  border-bottom: 2px solid #16251f;
}

.pdf-page-head span {
  color: #08745d;
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.pdf-page-head h2 {
  margin: 2px 0 0;
  font-size: 1.35rem;
}

.pdf-page-head strong {
  color: #53605d;
  font-size: 0.82rem;
  text-align: right;
}

.pdf-plan-frame {
  border: 1px solid #b8c8c2;
  background:
    linear-gradient(#e8f0ed 1px, transparent 1px),
    linear-gradient(90deg, #e8f0ed 1px, transparent 1px),
    #fbfdfc;
  background-size: 18px 18px;
}

.pdf-plan-svg {
  display: block;
  width: 100%;
  height: 176mm;
}

.pdf-schema-frame {
  overflow: hidden;
  border: none;
  background: #fff;
}

.pdf-schema-svg {
  display: block;
  width: 100%;
  height: auto;
}

.pdf-board-card {
  margin-bottom: 8mm;
}

.start-card {
  display: grid;
  gap: 15px;
  width: 100%;
  padding: 26px;
  border-color: rgba(16, 163, 127, 0.18);
  border-radius: 12px;
  box-shadow: 0 28px 70px rgba(23, 37, 33, 0.16);
}

.start-card-head {
  display: grid;
  gap: 2px;
  margin-bottom: 4px;
}

.start-card-head .eyebrow {
  margin-bottom: 0;
}

.start-card-head h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

.project-library {
  position: relative;
  grid-column: 1 / -1;
  width: min(920px, 100%);
  justify-self: center;
  margin-top: -16px;
  padding: 16px;
  border: 1px solid rgba(16, 163, 127, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 42px rgba(23, 37, 33, 0.08);
}

.project-screen.admin-mode .project-shell {
  display: block;
  width: min(1240px, calc(100vw - 48px));
  margin: 0 auto;
  padding-top: 72px;
}

.project-screen.admin-mode .hero,
.project-screen.admin-mode .start-card,
.project-screen.admin-mode .project-library-head,
.project-screen.admin-mode #projectList {
  display: none;
}

.project-screen.admin-mode .project-library {
  width: 100%;
  margin: 0 auto 48px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.account-panel {
  grid-column: 1 / -1;
  width: min(920px, 100%);
  justify-self: center;
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid rgba(16, 163, 127, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 14px 34px rgba(23, 37, 33, 0.07);
}

.project-library .account-panel {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  right: 0;
  width: 100%;
  margin-bottom: 12px;
  box-shadow: none;
}

.project-screen.admin-mode .project-library .account-panel {
  position: static;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.admin-console {
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(16, 163, 127, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 60px rgba(23, 37, 33, 0.12);
}

.admin-console-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.admin-view {
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 4px;
}

.admin-view .professional-section {
  min-width: 0;
}

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

.admin-section-title h3,
.admin-section-title p {
  margin-bottom: 0;
}

.admin-user-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
  gap: 14px;
  align-items: start;
}

.admin-user-layout h4 {
  margin: 0 0 8px;
}

.admin-table {
  width: 100%;
  min-width: 940px;
}

.admin-user-projects-table {
  min-width: 620px;
}

.tour-welcome,
.tour-overlay,
.help-center-shell {
  position: fixed;
  inset: 0;
  z-index: 10000;
}

.tour-welcome {
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
}

.tour-welcome-card,
.tour-card,
.help-panel {
  border: 1px solid rgba(16, 163, 127, 0.2);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.tour-welcome-card {
  display: grid;
  gap: 12px;
  width: min(480px, 100%);
  padding: 22px;
}

.tour-dim,
.help-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
}

.tour-spotlight {
  position: fixed;
  z-index: 10001;
  border: 3px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.42), 0 12px 35px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.tour-card {
  position: fixed;
  z-index: 10002;
  display: grid;
  gap: 10px;
  padding: 18px;
}

.tour-card h2,
.tour-card p,
.tour-welcome-card h2,
.tour-welcome-card p {
  margin: 0;
}

.tour-close {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 32px;
  padding: 5px 8px;
}

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

.tour-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ebe8;
}

.tour-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.link-button {
  justify-self: end;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
}

.help-center-shell {
  display: grid;
  justify-items: end;
}

.help-panel {
  position: relative;
  z-index: 10001;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(920px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  margin: 12px;
  overflow: hidden;
}

.help-head,
.help-search {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.help-head h2,
.help-head p {
  margin: 0;
}

.help-search label {
  flex: 1;
}

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

.help-topics {
  display: grid;
  align-content: start;
  gap: 6px;
  overflow: auto;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: #f7fbf9;
}

.help-topics button {
  justify-content: flex-start;
  text-align: left;
}

.help-topics button.active {
  border-color: var(--accent);
  background: var(--accent-dark);
  color: #fff;
}

.help-topic {
  overflow: auto;
  padding: 18px;
  line-height: 1.55;
}

.account-panel h2,
.account-panel p {
  margin-bottom: 0;
}

.account-panel-head,
.account-actions,
.account-list-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.account-meta {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.account-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(180px, 1fr) minmax(140px, 0.7fr) auto;
  gap: 10px;
  align-items: end;
}

.account-list {
  display: grid;
  gap: 8px;
}

.account-list-item {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.professional-profile-form {
  display: grid;
  gap: 12px;
  max-height: min(62vh, 680px);
  overflow: auto;
  padding-right: 4px;
}

.professional-section {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.professional-section h3 {
  margin: 0;
  font-size: 0.98rem;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.admin-nav button.active {
  background: #16352f;
  color: #fff;
  border-color: #16352f;
}

.admin-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(auto-fit, minmax(140px, 180px));
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.admin-table {
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  vertical-align: top;
}

.professional-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px 10px;
}

.professional-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.estimation-head,
.estimation-section {
  margin-bottom: 14px;
}

.estimation-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.estimation-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.estimation-section h3 {
  margin: 0;
  font-size: 1rem;
}

.estimation-section.warning {
  border-color: rgba(245, 158, 11, 0.35);
  background: #fffbeb;
}

.estimation-table {
  margin-top: 4px;
}

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

.admin-entitlement-grant {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(120px, 0.8fr) minmax(180px, 1.4fr) auto;
  gap: 8px;
  align-items: end;
  margin: 8px 0;
}

.admin-entitlement-grant label {
  display: grid;
  gap: 4px;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.admin-entitlement-grant input,
.admin-entitlement-grant select {
  min-height: 38px;
}

.admin-entitlement-grant button {
  min-height: 38px;
}

.quote-list {
  display: grid;
  gap: 8px;
}

.quote-card button {
  width: 100%;
  display: grid;
  gap: 3px;
  text-align: left;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
}

.quote-card.active button {
  border-color: #0f766e;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.12);
}

.quote-card small,
.quote-card span {
  color: var(--muted);
}

.warning-text {
  color: #b45309 !important;
  font-weight: 800;
}

.success-text {
  color: #166534 !important;
  font-weight: 800;
}

.quote-detail {
  gap: 14px;
}

.quote-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.quote-detail-head h3 {
  margin-bottom: 2px;
}

.quote-document-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: auto;
  padding: 20px;
  background: #f3f4f6;
}

.quote-document-toolbar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  max-width: 210mm;
  margin: 0 auto 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.quote-client-document {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 18mm;
  box-sizing: border-box;
  background: #fff;
  color: #171717;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10.5pt;
  line-height: 1.45;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.18);
}

.quote-client-header,
.quote-client-section.two-columns,
.quote-client-totals {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18mm;
}

.quote-client-header {
  align-items: start;
  padding-bottom: 10mm;
  border-bottom: 1px solid #d4d4d4;
}

.quote-client-header h1,
.quote-client-meta h2 {
  margin: 0 0 5mm;
  color: #111827;
  letter-spacing: 0;
}

.quote-client-eyebrow {
  margin: 0 0 2mm;
  color: #525252;
  font-size: 8pt;
  font-weight: 800;
  text-transform: uppercase;
}

.quote-client-document p {
  margin: 0 0 2mm;
}

.quote-client-meta {
  justify-self: end;
  min-width: 58mm;
  padding: 7mm;
  border: 1px solid #d4d4d4;
}

.quote-client-meta p {
  display: flex;
  justify-content: space-between;
  gap: 8mm;
}

.quote-draft-badge {
  display: inline-block;
  margin-bottom: 5mm;
  padding: 2mm 4mm;
  border: 1px solid #a16207;
  color: #854d0e;
  font-weight: 900;
}

.quote-client-section {
  margin-top: 9mm;
  break-inside: avoid;
  page-break-inside: avoid;
}

.quote-client-section h3,
.quote-client-notes h3 {
  margin: 0 0 4mm;
  color: #111827;
  font-size: 12pt;
}

.quote-client-lines {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.quote-client-lines th,
.quote-client-lines td {
  padding: 3.5mm 2.5mm;
  border-bottom: 1px solid #e5e5e5;
  vertical-align: top;
}

.quote-client-lines th {
  color: #404040;
  font-size: 8pt;
  text-align: left;
  text-transform: uppercase;
}

.quote-client-lines td span {
  display: block;
  margin-top: 1mm;
  color: #525252;
  font-size: 9pt;
}

.quote-client-lines .num,
.quote-client-totals .num {
  text-align: right;
  white-space: nowrap;
}

.quote-client-totals {
  align-items: start;
  margin-top: 10mm;
  break-inside: avoid;
  page-break-inside: avoid;
}

.quote-client-totals table {
  width: 100%;
  border-collapse: collapse;
  justify-self: end;
}

.quote-client-totals th,
.quote-client-totals td {
  padding: 3mm;
  border-bottom: 1px solid #e5e5e5;
  text-align: right;
}

.quote-client-grand-total th,
.quote-client-grand-total td {
  color: #111827;
  font-size: 13pt;
  font-weight: 900;
}

.quote-client-note {
  color: #525252;
  font-style: italic;
}

.quote-client-signature {
  margin-top: 18mm;
  padding-top: 7mm;
  border-top: 1px solid #d4d4d4;
}

.quote-client-signature div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18mm;
  min-height: 28mm;
}

.project-library-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.project-library-head h2,
.project-library-head .eyebrow {
  margin-bottom: 0;
}

.project-list {
  display: grid;
  gap: 8px;
}

.cloud-project-status {
  align-items: center;
  background: #eef6f3;
  border: 1px solid #c8ded6;
  border-radius: 8px;
  color: #16453b;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.9rem;
  gap: 10px;
  justify-content: space-between;
  padding: 10px 12px;
}

.cloud-project-status [data-status="saving"],
.cloud-project-status [data-status="pending"] {
  color: #8a5a00;
}

.cloud-project-status [data-status="error"],
.cloud-project-status [data-status="offline"],
.cloud-project-status [data-status="conflict"] {
  color: #b91c1c;
  font-weight: 700;
}

.project-empty {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.project-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.project-list-item.active {
  border-color: rgba(16, 163, 127, 0.42);
  box-shadow: inset 4px 0 0 var(--accent);
}

.project-list-item strong,
.project-list-item span,
.project-list-item small {
  display: block;
}

.project-list-item span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.project-list-item small {
  margin-top: 3px;
  color: #7a8783;
  font-size: 0.76rem;
  font-weight: 800;
}

.project-list-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.wizard-header,
.app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: var(--toolbar);
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

body:has(.account-topbar:not([hidden])) .wizard-header,
body:has(.account-topbar:not([hidden])) .app-bar {
  padding-right: min(440px, 42vw);
}

.app-bar h1 {
  font-size: 1.55rem;
}

.app-bar .eyebrow {
  margin-bottom: 3px;
}

.app-bar button,
.app-bar .file-btn,
.app-bar select {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 0.82rem;
}

.app-bar .top-actions {
  flex: 1;
  gap: 6px;
  justify-content: center;
}

.app-bar .tool-button.icon-only {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  align-items: center;
}

.toolbar-icon-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.72);
}

.undo-redo-group {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  gap: 0;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 10px 22px rgba(23, 37, 33, 0.08);
}

.undo-redo-group .tool-button.icon-only {
  width: 42px;
  min-width: 42px;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #111827;
}

.undo-redo-group .tool-button.icon-only svg {
  width: 21px;
  height: 21px;
  stroke-width: 2.6;
}

.undo-redo-group .tool-button.icon-only:hover:not(:disabled),
.undo-redo-group .tool-button.icon-only:focus-visible:not(:disabled) {
  background: #f2f7f4;
}

.undo-redo-group .tool-button.icon-only:disabled {
  color: #d7ddd9;
  opacity: 1;
  cursor: not-allowed;
}

.support-mode-banner {
  position: relative;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  padding: 10px 14px;
  border: 1px solid rgba(245, 158, 11, 0.42);
  border-left: 5px solid #f59e0b;
  border-radius: 8px;
  background: #fffbeb;
  color: #3f2c04;
}

.support-mode-banner[hidden],
.support-mode-banner:empty {
  display: none !important;
}

.support-mode-banner strong {
  font-size: 0.88rem;
  text-transform: uppercase;
}

.support-mode-banner span {
  flex: 1;
  color: #6b4e0c;
}

.support-mode-banner button {
  background: #fff;
}

.support-readonly .palette,
.support-readonly #planSvg {
  opacity: 0.92;
}

.action-menu {
  position: relative;
  display: inline-flex;
}

.menu-trigger {
  min-width: 82px;
}

.menu-trigger::after {
  content: "";
}

.menu-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  background: #f3fffb;
}

.action-dropdown {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  z-index: 70;
  display: grid;
  min-width: 190px;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(23, 37, 33, 0.16);
}

.action-dropdown[hidden] {
  display: none;
}

.action-dropdown button {
  justify-content: start;
  width: 100%;
  border-color: transparent;
  background: transparent;
  text-align: left;
}

.action-dropdown button:hover,
.action-dropdown button:focus-visible {
  border-color: #cfe4dc;
  background: #f3fffb;
}

.menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

.menu-trigger::after {
  content: "";
  width: 0;
  height: 0;
  margin-left: 0;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
  border-top: 5px solid var(--accent-dark);
  transform: translateY(1px);
}

.menu-trigger[aria-expanded="true"]::after {
  transform: rotate(180deg) translateY(-1px);
}

.action-dropdown {
  min-width: 210px;
}

.action-dropdown button {
  display: flex;
  align-items: center;
  min-height: 34px;
  color: var(--ink);
  white-space: nowrap;
}

.action-dropdown button.active,
.action-dropdown button.active:hover,
.action-dropdown button.active:focus-visible {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.cable-mode-btn {
  border-color: #2d608f;
  background: #eef6ff;
  color: #244f78;
}

.cable-mode-btn[hidden] {
  display: none;
}

.designer-screen.room-editing .top-actions > :not(#roomsMenu):not(#cableModeBtn) {
  display: none;
}

.designer-screen.room-editing .top-actions {
  gap: 8px;
}

.top-actions select {
  width: 145px;
}

.file-btn input {
  display: none;
}

.rooms-builder {
  max-width: 1380px;
  margin: 0 auto;
  padding: 18px;
}

.room-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 620px), 1fr));
  gap: 12px;
}

.room-row {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(120px, 1.25fr) minmax(100px, 0.9fr) minmax(110px, 0.9fr) 78px 78px 82px;
  gap: 8px;
  align-items: end;
  padding: 9px;
  box-shadow: 0 8px 22px rgba(27, 47, 40, 0.08);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
}

.room-row:hover {
  transform: translateY(-1px);
  border-color: rgba(16, 163, 127, 0.35);
  box-shadow: 0 12px 26px rgba(27, 47, 40, 0.12);
}

.room-row.dragging {
  opacity: 0.55;
}

.room-row.drop-before::before,
.room-row.drop-after::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.14);
}

.room-row.drop-before::before {
  top: -7px;
}

.room-row.drop-after::after {
  bottom: -7px;
}

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

.room-row label,
.room-row input,
.room-row select,
.room-row button {
  font-size: 0.78rem;
}

.room-row input,
.room-row select {
  min-height: 0;
  height: 30px;
  padding: 5px 7px;
  border-radius: 6px;
}

.room-drag-handle {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: stretch;
  width: 28px;
  padding: 0;
  border-color: transparent;
  background: #edf5f2;
  color: #08745d;
  cursor: grab;
  font-size: 1rem;
  line-height: 1;
}

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

.room-name-field,
.room-floor-field,
.room-type-field,
.room-length-field,
.room-width-field {
  grid-row: 1;
}

.room-name-field {
  grid-column: 2;
}

.room-floor-field {
  grid-column: 3;
}

.room-type-field {
  grid-column: 4;
}

.room-length-field {
  grid-column: 5;
}

.room-width-field {
  grid-column: 6;
}

.room-custom-field {
  grid-column: 2 / span 3;
  grid-row: 2;
}

.room-delete-button {
  grid-column: 7;
  grid-row: 1;
  min-height: 0;
  height: 30px;
  padding: 5px 8px;
  color: #9f1239;
}

.designer-screen.active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.designer-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 300px;
  gap: 12px;
  min-height: 0;
  height: auto;
  padding: 10px 12px 12px;
  overflow: hidden;
}

.palette,
.inspector,
.canvas-zone {
  min-height: 0;
}

.palette,
.inspector {
  overflow: auto;
  padding: 12px;
}

.inspector {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1.15fr) auto minmax(132px, 0.85fr);
  gap: 10px;
  overflow: hidden;
}

.inspector > h2 {
  margin: 2px 0 0;
}

.selection-panel,
.display-panel {
  min-height: 0;
  overflow: auto;
  padding: 10px;
  border: 1px solid #d3dfda;
  border-radius: 8px;
  background: linear-gradient(#ffffff, #f8fbf9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.display-panel {
  border-color: #bfded4;
  background: linear-gradient(#f7fffc, #edf7f3);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 -7px 14px rgba(0, 118, 92, 0.08);
}

.inspector > h2:not(:first-child) {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 -3px;
  color: #0f4f42;
  font-size: 0.86rem;
  letter-spacing: 0;
}

.inspector > h2:not(:first-child)::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #c9dad4;
}

.palette {
  background: linear-gradient(#ffffff, #f8fbf9);
}

.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.side-panel-header h2 {
  margin-bottom: 0;
}

.panel-toggle {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border-color: #cbd8d2;
  background: #f8fbf9;
  color: var(--accent-dark);
  font-size: 1.15rem;
  font-weight: 950;
}

.designer-layout.left-collapsed {
  grid-template-columns: 48px minmax(0, 1fr) 300px;
}

.designer-layout.right-collapsed {
  grid-template-columns: 250px minmax(0, 1fr) 48px;
}

.designer-layout.left-collapsed.right-collapsed {
  grid-template-columns: 48px minmax(0, 1fr) 48px;
}

.designer-layout.left-collapsed .palette,
.designer-layout.right-collapsed .inspector {
  overflow: hidden;
  padding: 8px 6px;
}

.designer-layout.left-collapsed .palette > :not(.side-panel-header),
.designer-layout.right-collapsed .inspector > :not(.side-panel-header) {
  display: none;
}

.designer-layout.left-collapsed .palette .side-panel-header,
.designer-layout.right-collapsed .inspector .side-panel-header {
  justify-content: center;
}

.designer-layout.left-collapsed .palette h2,
.designer-layout.right-collapsed .inspector h2 {
  display: none;
}

.palette-items {
  display: grid;
  gap: 8px;
}

.palette-item {
  display: grid;
  grid-template-columns: 46px 1fr 34px;
  gap: 10px;
  align-items: center;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px;
  cursor: grab;
  box-shadow: 0 7px 18px rgba(25, 41, 34, 0.05);
}

.palette-color {
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 2px;
  border-radius: 7px;
  cursor: pointer;
}

.palette-item:hover {
  border-color: rgba(16, 163, 127, 0.6);
  background: #f7fffb;
}

.board-palette-item {
  grid-template-columns: 54px 1fr;
}

.board-palette-item .palette-icon {
  width: 50px;
  color: #111827;
  font-size: 0.64rem;
  font-weight: 950;
  text-align: center;
  line-height: 1.05;
  background: linear-gradient(#ffffff, #e5ebe8);
  border: 1px solid #b8c3bd;
}

.palette-icon,
.item-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 38px;
  border-radius: 7px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 0.74rem;
  font-weight: 900;
}

.palette-item strong {
  display: block;
  font-size: 0.83rem;
}

.palette-item small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.hint {
  margin-top: 12px;
  border-left: 4px solid var(--orange);
  border-radius: 6px;
  background: #fff5e4;
  padding: 10px;
  color: #674118;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.canvas-zone {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  padding: 8px;
}

.floor-bar {
  display: grid;
  grid-template-columns: minmax(180px, 260px);
  gap: 8px;
  align-items: end;
  margin-bottom: 6px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

.floor-bar label {
  gap: 4px;
}

.zoom-bar {
  display: grid;
  grid-template-columns: 38px minmax(120px, 220px) 38px 58px auto;
  gap: 7px;
  align-items: center;
  margin-bottom: 6px;
}

.zoom-bar button {
  min-width: 0;
  padding: 7px 8px;
}

.zoom-bar span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 7px;
}

.tabs button {
  min-width: 92px;
}

.tabs button.locked-tab,
.locked-action {
  opacity: 0.45;
  filter: grayscale(1);
  cursor: not-allowed;
}

.tabs button.locked-tab {
  border-style: dashed;
  background: #eef1ef;
  color: #69736f;
}

.tabs button.locked-tab:hover {
  transform: none;
  box-shadow: none;
}

.access-lock-notice,
.access-lock-card {
  border: 1px solid #f1c27d;
  background: #fff8ec;
  color: #5f3b08;
  border-radius: 8px;
  padding: 12px 14px;
}

.access-lock-notice {
  display: grid;
  gap: 4px;
  margin: 10px 12px;
}

.access-lock-notice[hidden] {
  display: none;
}

.access-lock-card {
  margin: 16px;
  display: grid;
  gap: 8px;
}

.tab-panel {
  display: none;
  min-height: 0;
  overflow: auto;
}

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

#planTab.active {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

.canvas-wrap {
  height: 100%;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(16, 163, 127, 0.07) 1px, transparent 1px),
    linear-gradient(rgba(16, 163, 127, 0.07) 1px, transparent 1px),
    #fbfcfb;
  background-size: 20px 20px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
  cursor: grab;
}

.canvas-wrap.panning {
  cursor: grabbing;
}

#planSvg {
  display: block;
  width: max(100%, calc(1600px * var(--zoom, 1)));
  height: max(100%, calc(980px * var(--zoom, 1)));
  min-height: 520px;
  user-select: none;
  touch-action: none;
  cursor: grab;
}

.canvas-wrap.panning #planSvg {
  cursor: grabbing;
}

.floor-footprint {
  pointer-events: none;
}

.footprint-rect {
  fill: rgba(16, 163, 127, 0.035);
  stroke: rgba(8, 116, 93, 0.75);
  stroke-width: 3;
  stroke-dasharray: 12 8;
  vector-effect: non-scaling-stroke;
}

.footprint-room-rect {
  fill: rgba(16, 163, 127, 0.02);
  stroke-width: 2;
}

.footprint-label {
  fill: var(--accent-dark);
  font-size: calc(12px / var(--render-zoom, 1));
  font-weight: 900;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: calc(4px / var(--render-zoom, 1));
}

.footprint-room-label {
  fill: rgba(8, 116, 93, 0.58);
  font-size: calc(10px / var(--render-zoom, 1));
  font-weight: 900;
  text-anchor: middle;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: calc(3px / var(--render-zoom, 1));
}

.room-shape {
  cursor: move;
}

.room-rect {
  fill: rgba(255, 255, 255, 0.86);
  stroke: #7c8f88;
  stroke-width: 3;
  filter: drop-shadow(0 4px 5px rgba(24, 35, 31, 0.07));
  vector-effect: non-scaling-stroke;
}

.room-rect.selected {
  stroke: var(--orange);
  stroke-width: 4;
}

.room-rect.polygonal {
  fill: rgba(255, 255, 255, 0.9);
}

.room-wall-hit {
  fill: none;
  stroke: transparent;
  stroke-linecap: round;
  stroke-linejoin: round;
  cursor: move;
  pointer-events: stroke;
  vector-effect: non-scaling-stroke;
}

.room-segment-handle {
  fill: #fff;
  stroke: var(--orange);
  stroke-width: 3;
  cursor: move;
  pointer-events: all;
  vector-effect: non-scaling-stroke;
}

.room-segment-handle:hover {
  fill: #fff7ed;
  stroke-width: 4;
}

.room-label {
  fill: var(--ink);
  font-size: calc(13px / var(--render-zoom, 1));
  font-weight: 900;
  text-anchor: middle;
  pointer-events: none;
  opacity: 0.82;
}

.room-size {
  fill: var(--muted);
  font-size: calc(10px / var(--render-zoom, 1));
  text-anchor: middle;
  pointer-events: none;
  opacity: 0.78;
}

.resize-handle {
  fill: var(--orange);
  stroke: #fff;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.room-vertex {
  fill: #fff;
  stroke: var(--orange);
  stroke-width: 3;
  cursor: grab;
  vector-effect: non-scaling-stroke;
}

.room-vertex:hover,
.room-vertex.active {
  fill: #fff7ed;
  stroke-width: 4;
}

.room-snap-hint text {
  fill: #059669;
  font-size: calc(12px / var(--render-zoom, 1));
  font-weight: 900;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: calc(4px / var(--render-zoom, 1));
  pointer-events: none;
}

.room-polygon-summary {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  align-self: end;
  padding-bottom: 0.45rem;
}

.resize-n,
.resize-s {
  cursor: ns-resize;
}

.resize-e,
.resize-w {
  cursor: ew-resize;
}

.resize-ne,
.resize-sw {
  cursor: nesw-resize;
}

.resize-nw,
.resize-se {
  cursor: nwse-resize;
}

.cable {
  fill: none;
  stroke: #2878b8;
  stroke-width: 1.2;
  stroke-linejoin: round;
  stroke-linecap: round;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(255, 255, 255, 0.9));
  vector-effect: non-scaling-stroke;
}

.cable-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 30;
  stroke-linejoin: round;
  stroke-linecap: round;
  cursor: pointer;
  pointer-events: stroke;
  vector-effect: non-scaling-stroke;
}

.cable.manual {
  stroke: var(--orange);
}

.cable.curved {
  stroke-width: 1.05;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: none;
}

.cable.vertical-supply {
  stroke-dasharray: 9 6;
}

.cable.selected {
  stroke-width: 2.4;
}

.cable.related {
  stroke-width: 3.2;
  filter: drop-shadow(0 0 5px rgba(250, 204, 21, 0.95));
}

.cable-label {
  fill: #1e3e5e;
  font-size: calc(12px / var(--render-zoom, 1));
  font-weight: 900;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: calc(4px / var(--render-zoom, 1));
  opacity: 0;
  pointer-events: none;
}

.cable-layer:hover .cable-label,
.cable-layer.selected .cable-label,
.cable-hit:hover ~ .cable-label,
.cable:hover ~ .cable-label {
  opacity: 1;
}

.cable-label.always-visible {
  opacity: 1;
}

.cable-node {
  fill: #fff;
  stroke: #dc2626;
  stroke-width: 3;
  cursor: grab;
  vector-effect: non-scaling-stroke;
}

.cable-node:hover {
  fill: #fee2e2;
  stroke-width: 4;
}

.cable-node.curve-node {
  stroke: #2563eb;
}

.cable-node.curve-node:hover {
  fill: #dbeafe;
}

.cable-riser-marker {
  pointer-events: none;
}

.cable-riser-marker circle {
  fill: #fff;
  stroke: var(--orange);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.cable-riser-marker text {
  fill: #7c2d12;
  font-size: calc(10px / var(--render-zoom, 1));
  font-weight: 900;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: calc(3px / var(--render-zoom, 1));
}

.cable-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.cable-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.cable-legend i {
  width: 20px;
  height: 4px;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.08);
}

.cable-color-grid {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.cable-color-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
  align-items: center;
  margin: 0;
}

.cable-color-row span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.cable-color-row i {
  width: 24px;
  height: 5px;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.08);
}

.cable-color-row input[type="color"] {
  width: 38px;
  height: 30px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.plan-item {
  cursor: move;
}

.item-hit {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
}

.item-select-ring {
  display: none;
  fill: rgba(216, 95, 54, 0.12);
  stroke: var(--orange);
  stroke-width: 1.2;
  stroke-dasharray: 3 2;
  pointer-events: none;
}

.item-select-ring.selected {
  display: block;
}

.item-dot {
  display: block;
  opacity: 0.42;
  stroke: rgba(255, 255, 255, 0.88);
  stroke-width: 1.8;
  pointer-events: none;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
}

.item-box {
  fill: #ffffff;
  stroke: var(--accent-dark);
  stroke-width: 0.35;
  filter: none;
  pointer-events: none;
}

.item-box.board {
  fill: #e7f0f7;
  stroke: var(--blue);
}

.item-box.meter {
  fill: #fff1c2;
  stroke: #86651c;
}

.item-box.riser {
  fill: #fff7ed;
  stroke: var(--orange);
  stroke-dasharray: 1.2 1;
}

.item-box.selected {
  stroke: var(--orange);
  stroke-width: 0.5;
}

.item-text {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 900;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.item-foreign,
.item-svg {
  pointer-events: none;
}

.item-svg {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--accent-dark);
}

.item-svg svg {
  width: 100%;
  height: 100%;
  display: block;
}

.plan-item.compact .item-box,
.plan-item.compact .item-foreign {
  display: none;
}

.plan-item.compact .item-dot {
  display: block;
  opacity: 0.78;
}

.selection-panel,
.display-panel {
  display: grid;
  gap: 10px;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.quick-stats-card {
  display: grid;
  gap: 8px;
}

.quick-stats-card h3 {
  margin-bottom: 0;
}

.metric-grid.compact {
  gap: 6px;
}

.metric,
.mini-card,
.label-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.settings-card {
  gap: 10px;
}

.settings-card h3 {
  margin-bottom: 0;
}

.muted {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.footprint-summary {
  display: grid;
  gap: 7px;
}

.footprint-summary-row {
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fbf9;
}

.footprint-summary-row strong {
  color: var(--accent-dark);
}

.footprint-summary-row span,
.footprint-summary-row small {
  color: var(--muted);
  font-weight: 850;
}

.check-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.check-row input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

.cable-filter-box {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

.cable-filter-box strong {
  color: var(--ink);
  font-size: 0.82rem;
}

.cable-filter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.cable-filter-option span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 900;
}

.cable-filter-option i {
  width: 18px;
  height: 4px;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.danger-button {
  border-color: #d65b4f;
  background: #fff4f1;
  color: #9a251d;
}

.danger-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.metric strong {
  display: block;
  color: var(--accent);
  font-size: 1.25rem;
}

.metric-grid.compact .metric {
  padding: 7px 8px;
  font-size: 0.78rem;
}

.metric-grid.compact .metric strong {
  font-size: 1rem;
}

.print-sheet {
  padding: 4px;
}

.sheet-grid,
.label-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
}

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

.board-card {
  width: 100%;
}

.print-card h3 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.print-card {
  box-shadow: none;
  padding: 12px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-grid;
  place-items: center;
  min-height: 24px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--accent-dark);
  padding: 3px 7px;
  font-size: 0.75rem;
  font-weight: 900;
}

.warning {
  border-left: 5px solid var(--orange);
  background: #fff5e4;
}

.ok {
  border-left: 5px solid var(--accent);
}

.board-row {
  display: grid;
  grid-template-columns: repeat(13, minmax(42px, 1fr));
  gap: 2px;
  margin-top: 0;
  padding: 10px 12px 12px;
  border: 0;
  border-radius: 6px;
  background: linear-gradient(#f3f5f4, #d9dfdc);
  box-shadow: inset 0 5px 10px rgba(0, 0, 0, 0.16), inset 0 -2px 3px rgba(255, 255, 255, 0.75);
}

.module {
  min-height: 82px;
  border: 1px solid #aeb8b3;
  border-radius: 3px;
  background: linear-gradient(90deg, #fdfefe, #e9efec);
  padding: 6px 4px;
  overflow: hidden;
  font-size: 0.68rem;
  font-weight: 800;
  position: relative;
  box-shadow: inset -4px 0 0 rgba(0, 0, 0, 0.04), inset 1px 0 0 rgba(255, 255, 255, 0.9);
}

.module.diff {
  grid-column: span 2;
  background: linear-gradient(90deg, #fbfdff, #dfeeff);
}

.module.reserve {
  opacity: 0.45;
}

.circuit-module {
  padding-top: 28px;
}

.manual-module,
.automatic-module {
  padding-top: 28px;
}

.module-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 20px;
  min-height: 0;
  padding: 0;
  border: 1px solid #c24a3d;
  border-radius: 4px;
  background: #fff4f1;
  color: #9a251d;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.module-delete:hover {
  background: #ffd9d2;
  color: #711911;
}

.module-order {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 3px;
}

.module-order button {
  width: 22px;
  height: 20px;
  min-height: 0;
  padding: 0;
  border-radius: 4px;
  font-size: 0.9rem;
  line-height: 1;
}

.module-drag-handle {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 22px;
  border-radius: 3px;
  cursor: grab;
  background:
    radial-gradient(circle, #9aa7a1 1.2px, transparent 1.5px) 0 0 / 6px 6px,
    rgba(255, 255, 255, 0.75);
  border: 1px solid #c8d1cc;
}

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

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

.manual-module.diff {
  background: linear-gradient(90deg, #fff, #e6f0ff);
}

.manual-module.control,
.automatic-module.control {
  background: linear-gradient(90deg, #fff, #f1f5f9);
}

.manual-module.reserve {
  background: linear-gradient(90deg, #fff, #eef2f0);
  opacity: 0.75;
}

.board-card {
  background: #f7f8f7;
}

.board-config {
  display: grid;
  grid-template-columns: 1.3fr 1.2fr 0.7fr 0.8fr;
  gap: 8px;
  margin-bottom: 10px;
  align-items: end;
}

.board-config label {
  font-size: 0.72rem;
}

.board-config input,
.board-config select {
  min-height: 34px;
}

.board-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.board-summary strong,
.board-summary span {
  border: 1px solid #d6ddd9;
  border-radius: 6px;
  background: #fff;
  padding: 5px 8px;
}

.real-board {
  position: relative;
  border: 12px solid #e2e8e4;
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.55), rgba(0, 0, 0, 0.06)),
    #cfd8d3;
  box-shadow:
    inset 0 0 0 2px #f8faf8,
    inset 0 0 30px rgba(0, 0, 0, 0.12),
    0 16px 28px rgba(15, 23, 42, 0.12);
  padding: 18px;
}

.real-board::before,
.real-board::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #9aa7a1 55%, #5f6a65);
  top: 8px;
}

.real-board::before {
  left: 10px;
}

.real-board::after {
  right: 10px;
}

.board-cover {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 6px 6px 0 0;
  padding: 7px 12px;
  color: #35413c;
  background: linear-gradient(#eef3f0, #cfd8d3);
  border: 1px solid #aeb8b3;
  box-shadow: inset 0 1px 0 #fff;
}

.board-brand {
  font-size: 0.82rem;
  font-weight: 950;
  text-transform: uppercase;
}

.board-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 8px rgba(22, 163, 74, 0.55);
}

.board-cavity {
  border: 1px solid #9aa7a1;
  border-top: 0;
  background: #bfc9c4;
  padding: 12px;
}

.real-board-row {
  position: relative;
  margin-bottom: 12px;
}

.real-board-row:last-child {
  margin-bottom: 0;
}

.real-board-row h3 {
  margin: 0 0 4px;
  color: #485651;
  font-size: 0.72rem;
  justify-content: flex-start;
}

.din-rail {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 55px;
  height: 12px;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, #9aa3a0 0 12px, #c4cbc8 12px 22px);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.22);
}

.real-module {
  z-index: 1;
  display: grid;
  align-content: start;
  gap: 2px;
  text-align: center;
}

.real-module strong {
  color: #111827;
  font-size: 0.72rem;
}

.real-module em {
  min-height: 24px;
  color: #39443f;
  font-style: normal;
  font-size: 0.58rem;
  line-height: 1.05;
}

.real-module b {
  color: #111827;
  font-size: 0.6rem;
}

.module-toggle {
  display: block;
  width: 18px;
  height: 20px;
  margin: 0 auto 3px;
  border: 1px solid #8b9691;
  border-radius: 2px;
  background: linear-gradient(#ffffff 0 45%, #3f4a45 46% 56%, #dfe5e2 57%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.label-card {
  min-height: 52px;
  border: 2px solid #333;
  display: grid;
  align-content: center;
  gap: 2px;
  text-align: center;
}

.source-note {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.hover-tooltip {
  position: fixed;
  z-index: 1000;
  display: none;
  min-width: 190px;
  max-width: 270px;
  border: 1px solid rgba(8, 116, 93, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 14px 35px rgba(24, 35, 31, 0.18);
  padding: 10px 11px;
  color: var(--ink);
  pointer-events: none;
}

.hover-tooltip.visible {
  display: grid;
  gap: 3px;
}

.hover-tooltip strong {
  color: var(--accent-dark);
  font-size: 0.86rem;
}

.hover-tooltip span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.materials-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.materials-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.materials-head h2 {
  margin: 0;
}

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

.material-action-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

.material-action-group span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 950;
  text-transform: uppercase;
}

.materials-table th,
.materials-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 9px;
  text-align: left;
  vertical-align: middle;
}

.materials-table th {
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.materials-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.catalog-table td span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.catalog-table input[type="number"] {
  width: 110px;
  min-height: 32px;
}

.price-input {
  width: 105px;
  min-height: 32px;
}

.materials-table tfoot td {
  background: #f8faf8;
  font-weight: 900;
}

.control-dashboard {
  display: grid;
  gap: 14px;
}

.control-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 430px);
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid #cbdad4;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #eef8f4);
}

.control-summary h2 {
  margin: 2px 0 6px;
}

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

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

.control-score {
  display: grid;
  gap: 2px;
  min-height: 72px;
  place-items: center;
  border: 1px solid #d6ddd9;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
}

.control-score strong {
  color: var(--accent-dark);
  font-size: 1.5rem;
}

.control-score.danger strong {
  color: #b91c1c;
}

.control-score.warning strong {
  color: #b45309;
}

.control-score.info strong {
  color: #0369a1;
}

.control-section {
  display: grid;
  gap: 10px;
}

.control-section h3 {
  margin: 0;
}

.diagnostic-list,
.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.diagnostic-card,
.diagnostic-empty,
.rule-card {
  display: grid;
  gap: 7px;
  border: 1px solid #d6ddd9;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.diagnostic-card {
  border-left-width: 5px;
}

.diagnostic-card.critical {
  border-left-color: #dc2626;
  background: #fff7f7;
}

.diagnostic-card.warning {
  border-left-color: #f59e0b;
  background: #fffaf0;
}

.diagnostic-card.info {
  border-left-color: #0284c7;
  background: #f2f9ff;
}

.diagnostic-card span,
.rule-card small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
}

.diagnostic-card strong,
.diagnostic-empty strong,
.rule-card strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.diagnostic-card p,
.diagnostic-card em,
.diagnostic-empty span,
.rule-card p {
  margin: 0;
  color: #53605d;
  font-size: 0.84rem;
  line-height: 1.4;
}

.diagnostic-card em {
  color: #18352f;
  font-style: normal;
  font-weight: 900;
}

.resolved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.resolved-grid span {
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid #bbded2;
  border-radius: 8px;
  background: #f4fffb;
  color: #0f6d5d;
  font-size: 0.82rem;
  font-weight: 900;
}

.schematic-card {
  overflow: auto;
}

.schema-tools {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: 38px minmax(160px, 260px) 38px 64px;
  gap: 7px;
  align-items: center;
  margin-bottom: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 251, 249, 0.96);
}

.schema-tools button {
  min-width: 0;
  padding: 7px 8px;
}

.schematic-svg {
  display: block;
  width: 100%;
  min-width: 720px;
  height: auto;
  margin: 8px 0 12px;
  background: #fff;
  border: 1px solid #c7d0ca;
}

.habitation-card {
  background: #f8faf8;
  overflow: auto;
}

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

.schema-app-page {
  overflow: auto;
  padding: 10px;
  border: 1px solid #b8c8c2;
  border-radius: 8px;
  background: #e3e3e3;
}

.schema-app-page-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 8px;
  color: #172521;
  font-size: 0.84rem;
  font-weight: 900;
}

.schema-app-page-head span {
  color: #53605d;
  text-align: right;
}

.habitation-schema-svg {
  display: block;
  min-width: 960px;
  height: auto;
  background: #fff;
  border: 1px solid #b9b9b9;
}

.schema-app-svg {
  min-width: 0 !important;
}

.schema-bg {
  fill: #d3d3d3;
}

.schema-bus,
.schema-feed,
.schema-drop,
.schema-wire {
  fill: none;
  stroke: #050505;
  stroke-width: 3;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.schema-drop {
  stroke-width: 3;
}

.schema-diff,
.schema-breaker,
.schema-diff-loop,
.schema-test,
.schema-contact,
.schema-auto-module rect {
  fill: #fff;
  stroke: #050505;
  stroke-width: 2.4;
}

.schema-contact {
  fill: #d3d3d3;
}

.schema-dashed {
  fill: none;
  stroke: #050505;
  stroke-width: 1.8;
  stroke-dasharray: 5 4;
}

.schema-phase,
.schema-neutral,
.schema-earth {
  stroke-width: 4;
  stroke-linecap: round;
}

.schema-phase {
  stroke: #e60000;
}

.schema-neutral {
  stroke: #0038ff;
}

.schema-earth {
  stroke: #00a944;
}

.schema-breaker {
  fill: #f4f7fb;
}

.schema-terminal {
  fill: #fff;
  stroke: #151b18;
  stroke-width: 3;
}

.schema-title,
.schema-small,
.schema-circuit,
.schema-note,
.schema-main-title,
.schema-main-info,
.schema-q-title,
.schema-q-info,
.schema-dj-label,
.schema-dj-amp,
.schema-control-note,
.schema-section,
.schema-circuit-name,
.schema-cable-rot,
.schema-auto-title,
.schema-auto-info,
.schema-test-text {
  fill: #151b18;
  font-family: Arial, Helvetica, sans-serif;
  text-anchor: middle;
  dominant-baseline: middle;
}

.schema-title {
  text-anchor: start;
  font-size: 14px;
  font-weight: 900;
}

.schema-small {
  font-size: 12px;
  font-weight: 900;
}

.schema-circuit {
  font-size: 12px;
  font-weight: 900;
}

.schema-note {
  fill: #4d5b55;
  font-size: 10px;
}

.schema-main-title,
.schema-q-title {
  font-size: 15px;
  font-weight: 900;
}

.schema-main-info,
.schema-q-info {
  font-size: 13px;
  font-weight: 800;
}

.schema-dj-label {
  font-size: 11px;
  font-weight: 900;
}

.schema-dj-amp {
  font-size: 10px;
  font-weight: 900;
}

.schema-control-note {
  font-size: 9px;
  font-weight: 900;
}

.schema-auto-title {
  font-size: 13px;
  font-weight: 900;
}

.schema-auto-info {
  font-size: 9px;
  font-weight: 900;
}

.schema-section {
  font-size: 9px;
  font-weight: 900;
}

.schema-circuit-name {
  font-size: 8.5px;
  font-weight: 900;
  text-anchor: start;
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: #d2d2d2;
  stroke-width: 3px;
}

.schema-cable-rot {
  font-size: 8px;
  font-weight: 900;
}

.schema-test-text {
  font-size: 12px;
  font-weight: 900;
}

.schema-device-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #222;
}

.schema-device-icon svg {
  background: #efefef;
  border: 1px solid #9d9d9d;
}

.schema-page-link rect {
  fill: #fff7cc;
  stroke: #111827;
  stroke-width: 1.3;
}

.schema-page-link text {
  fill: #111827;
  font-size: 11px;
  font-weight: 900;
}

.schema-page-ref {
  fill: #111827;
  font-size: 12px;
  font-weight: 900;
  text-anchor: middle;
}

.unifilar-bg,
.unifilar-table-bg {
  fill: #fff;
}

.unifilar-frame,
.unifilar-table-line,
.unifilar-title-block rect,
.unifilar-title-block line,
.unifilar-grid {
  fill: none;
  stroke: #111;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.unifilar-bus {
  stroke: #050505;
  stroke-width: 4.5;
  stroke-linecap: square;
  vector-effect: non-scaling-stroke;
}

.unifilar-wire,
.unifilar-switch,
.unifilar-breaker {
  fill: none;
  stroke: #111;
  stroke-width: 1.4;
  stroke-linecap: square;
  stroke-linejoin: miter;
  vector-effect: non-scaling-stroke;
}

.unifilar-pe {
  stroke: #111;
  stroke-width: 1.1;
  stroke-dasharray: 7 7;
  vector-effect: non-scaling-stroke;
}

.unifilar-diff rect,
.unifilar-telerupteur rect,
.unifilar-module-icon rect {
  fill: #fff;
  stroke: #111;
  stroke-width: 1.1;
  vector-effect: non-scaling-stroke;
}

.unifilar-node {
  fill: #111;
}

.unifilar-continuity path {
  fill: #fff;
  stroke: #111;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.unifilar-grid-text,
.unifilar-page-corner,
.unifilar-continuity text,
.unifilar-continuity-label,
.unifilar-device-info,
.unifilar-device-index,
.unifilar-pe-label,
.unifilar-table-label,
.unifilar-table-value,
.unifilar-designation,
.unifilar-module-icon text,
.unifilar-title-main,
.unifilar-title-sub,
.unifilar-cartouche-label,
.unifilar-cartouche-value {
  fill: #111;
  font-family: Arial, Helvetica, sans-serif;
  dominant-baseline: middle;
}

.unifilar-grid-text,
.unifilar-page-corner {
  font-size: 8px;
  text-anchor: middle;
  font-weight: 700;
}

.unifilar-device-info {
  font-size: 10px;
  text-anchor: start;
}

.unifilar-device-info-centered {
  text-anchor: middle;
  font-weight: 800;
}

.unifilar-control-wire,
.unifilar-push-contact,
.unifilar-relay-contact,
.unifilar-relay-coil {
  fill: none;
  stroke: #111;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.unifilar-terminal {
  fill: #111;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 7px;
  font-weight: 800;
  dominant-baseline: middle;
  text-anchor: middle;
}

.unifilar-device-index {
  font-size: 9px;
  text-anchor: middle;
  font-weight: 700;
}

.unifilar-pe-label,
.unifilar-table-label,
.unifilar-table-value {
  font-size: 11px;
  text-anchor: middle;
}

.unifilar-designation {
  font-size: 8.2px;
  text-anchor: middle;
  font-weight: 700;
}

.unifilar-device-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: #333;
}

.unifilar-device-icon svg {
  background: #fff;
  border: 0;
}

.unifilar-module-icon text {
  font-size: 12px;
  text-anchor: middle;
  font-weight: 900;
}

.unifilar-title-main {
  font-size: 19px;
  font-weight: 900;
  text-anchor: middle;
}

.unifilar-title-sub {
  font-size: 18px;
  font-weight: 900;
  text-anchor: middle;
}

.unifilar-cartouche-label,
.unifilar-cartouche-value {
  font-size: 13px;
}

.unifilar-cartouche-label {
  text-anchor: middle;
}

.unifilar-cartouche-value {
  text-anchor: middle;
  font-weight: 700;
}

.unifilar-continuity text {
  font-size: 8px;
  text-anchor: middle;
  font-weight: 900;
}

.unifilar-continuity-label {
  font-size: 10px;
  text-anchor: start;
  font-weight: 800;
}

.label-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.inline-check {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  min-height: 38px;
}

.inline-check input {
  min-height: auto;
}

.custom-label-grid {
  display: grid;
  grid-template-columns: repeat(var(--label-cols), var(--label-w));
  align-items: start;
  justify-content: start;
  gap: 2mm;
}

.custom-label {
  width: var(--label-w);
  min-height: var(--label-h);
  padding: 1.5mm;
  font-size: var(--label-font);
  line-height: 1.12;
}

.custom-label small {
  color: var(--muted);
  font-size: 0.78em;
}

.label-sheet-card {
  overflow: auto;
  background: #fff;
}

.module-ruler {
  position: relative;
  height: 24px;
  margin: 6px 0 4px;
  color: #ff0000;
  font-size: 0.9rem;
}

.module-ruler span {
  position: absolute;
  top: 0;
  border-top: 1px solid #ff0000;
  text-align: center;
}

.module-ruler span::before,
.module-ruler span::after {
  content: "";
  position: absolute;
  top: -7px;
  width: 1px;
  height: 24px;
  background: #ff0000;
}

.module-ruler span::before {
  left: 0;
}

.module-ruler span::after {
  right: 0;
}

.ruler-double {
  left: 0;
  width: 35mm;
}

.ruler-single {
  left: 210mm;
  width: 17.5mm;
}

.label-strip {
  display: flex;
  align-items: stretch;
  width: max-content;
  min-height: 33mm;
  margin: 8mm 0;
  border-left: 2px solid #000;
  background: #fff;
}

.print-label {
  display: grid;
  grid-template-rows: 12mm 1fr;
  place-items: start center;
  box-sizing: border-box;
  flex: 0 0 auto;
  height: 33mm;
  border-top: 2px solid #000;
  border-right: 2px solid #000;
  border-bottom: 2px solid #000;
  padding: 1.2mm 1mm;
  color: #000;
  text-align: center;
  overflow: hidden;
  font-size: 6pt;
  line-height: 1.05;
}

.print-label strong,
.print-label b {
  align-self: center;
  font-size: 9pt;
  line-height: 1.15;
}

.label-wide {
  grid-template-rows: 1fr 1fr;
  place-items: center;
}

.label-main strong {
  color: #f00;
  font-size: 8pt;
}

.label-main b {
  font-size: 9pt;
}

.label-icon {
  display: grid;
  place-items: center;
  width: 9mm;
  height: 9mm;
  border: 1px solid #000;
}

.label-icon svg {
  width: 8mm;
  height: 8mm;
  color: #000;
}

.label-manual {
  grid-template-rows: 9mm 1fr 5mm;
}

.label-text-icon {
  color: #000;
  font-size: 5pt;
  font-weight: 900;
  line-height: 1;
}

.print-label small {
  color: #000;
  font-size: 5pt;
  font-weight: 800;
  line-height: 1;
}

@media (max-width: 1180px) {
  .account-topbar {
    position: sticky;
    top: 0;
    right: auto;
    display: flex;
    justify-content: flex-end;
    padding: 8px 10px 0;
    background: rgba(238, 242, 239, 0.96);
    backdrop-filter: blur(10px);
  }

  .account-topbar[hidden] {
    display: none;
  }

  body:has(.account-topbar:not([hidden])) .wizard-header,
  body:has(.account-topbar:not([hidden])) .app-bar {
    padding-right: 16px;
  }

  .designer-layout {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .inspector {
    grid-column: 1 / -1;
    max-height: 260px;
  }

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

@media (max-width: 820px) {
  .project-screen.active {
    display: grid;
  }

  .project-shell {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .hero {
    text-align: left;
  }

  .hero-steps {
    margin-top: 16px;
  }

  .project-library {
    margin-top: 0;
  }

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

  .project-list-actions {
    justify-content: stretch;
  }

  .project-list-actions button {
    width: 100%;
  }

  .wizard-header,
  .app-bar {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .room-row,
  .field-grid,
  .admin-entitlement-grant,
  .admin-user-layout,
  .help-body,
  .designer-layout {
    grid-template-columns: 1fr;
  }

  .help-panel {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    margin: 8px;
  }

  .help-head,
  .help-search {
    align-items: stretch;
    flex-direction: column;
  }

  .designer-layout {
    height: auto;
  }

  .canvas-wrap {
    height: 70vh;
  }

  .board-config {
    grid-template-columns: 1fr 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  .project-screen,
  .rooms-screen,
  .account-topbar,
  .app-bar,
  .palette,
  .inspector,
  .tabs {
    display: none !important;
  }

  .zoom-bar,
  .floor-bar,
  .panel-toggle,
  .label-controls,
  .board-config,
  .module-delete,
  .module-order {
    display: none !important;
  }

  .circuit-module {
    padding-top: 5px;
  }

  .designer-screen,
  .designer-screen.active {
    display: block !important;
  }

  .designer-layout {
    display: block;
    height: auto;
    padding: 0;
  }

  .canvas-zone {
    border: none;
    box-shadow: none;
    padding: 0;
  }

  .tab-panel {
    display: block !important;
    page-break-after: always;
    overflow: visible;
  }

  .tab-panel:last-child {
    page-break-after: auto;
  }

  .canvas-wrap {
    height: 180mm;
    min-height: 0;
  }

  .custom-label-grid {
    grid-template-columns: repeat(var(--label-cols), var(--label-w));
  }

  .label-sheet-card {
    overflow: visible;
  }

  .label-strip {
    break-inside: avoid;
  }

  .item-select-ring,
  .item-hit {
    display: none !important;
  }

  .print-card,
  .mini-card,
  .metric,
  .label-card {
    break-inside: avoid;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 0;
  }

  body {
    background: #fff !important;
  }

  .project-screen,
  .rooms-screen,
  .designer-screen,
  .designer-screen.active,
  .screen,
  .screen.active,
  .app-bar,
  .palette,
  .inspector,
  .canvas-zone,
  .tabs {
    display: none !important;
  }

  .pdf-report {
    display: block !important;
  }

  .pdf-page {
    display: block;
    width: var(--print-page-w, 297mm);
    height: var(--print-page-h, 210mm);
    min-height: var(--print-page-h, 210mm);
    padding: var(--print-page-pad, 6mm);
    overflow: hidden;
    box-sizing: border-box;
    break-after: page;
    page-break-after: always;
    box-shadow: none;
  }

  .pdf-plan-page,
  .pdf-schema-page {
    padding: var(--print-tight-pad, 4mm);
  }

  .pdf-plan-page {
    display: flex;
    flex-direction: column;
    gap: 2mm;
  }

  .pdf-schema-full-page {
    width: var(--print-page-w, 297mm);
    height: var(--print-page-h, 210mm);
    min-height: var(--print-page-h, 210mm);
    padding: 0 !important;
    overflow: hidden;
  }

  .pdf-schema-full-page .pdf-schema-frame {
    width: var(--print-page-w, 297mm);
    height: var(--print-page-h, 210mm);
    overflow: hidden;
    border: none;
    background: #fff;
  }

  .pdf-plan-page .pdf-page-head,
  .pdf-schema-page .pdf-page-head {
    min-height: 14mm;
    margin-bottom: 2mm;
    padding-bottom: 2mm;
  }

  .pdf-plan-page .pdf-plan-svg {
    height: 100%;
  }

  .pdf-plan-page .pdf-plan-frame {
    flex: 1 1 auto;
    min-height: 0;
  }

  .pdf-plan-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 2mm;
    align-items: center;
    min-height: 7mm;
    padding: 1.2mm 2mm;
    border: 1px solid #b8c8c2;
    background: #fff;
  }

  .pdf-plan-legend span {
    display: inline-flex;
    align-items: center;
    gap: 1.5mm;
    color: #172521;
    font-size: 8pt;
    font-weight: 800;
    white-space: nowrap;
  }

  .pdf-plan-legend i {
    width: 12mm;
    height: 1.2mm;
    border-radius: 999px;
  }

  .pdf-plan-page .pdf-plan-svg,
  .pdf-schema-page .pdf-schema-svg,
  .pdf-report .habitation-schema-svg.pdf-schema-svg {
    min-width: 0 !important;
    max-width: none !important;
    display: block;
  }

  .pdf-schema-page .pdf-schema-svg {
    width: 100%;
    height: 100%;
  }

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

  .pdf-cover {
    width: var(--print-page-w, 297mm);
    height: var(--print-page-h, 210mm);
    min-height: var(--print-page-h, 210mm);
    padding: var(--print-cover-pad, 24mm);
    box-sizing: border-box;
  }

  .pdf-cover-grid,
  .pdf-metrics {
    grid-template-columns: repeat(4, 1fr);
  }

  .pdf-plan-frame,
  .habitation-card,
  .board-card,
  .label-sheet-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .pdf-report .print-card {
    border-color: #b8c8c2;
    box-shadow: none;
  }

  .pdf-report .schematic-card,
  .pdf-report .board-card,
  .pdf-report .label-sheet-card {
    margin-bottom: 8mm;
  }

  .pdf-label-page .label-sheet-card {
    padding: 0;
    border: none;
    overflow: visible;
  }

  .pdf-label-page .label-strip {
    margin: 2mm 0;
  }

  .pdf-label-page .module-ruler {
    margin: 2mm 0 1mm;
  }

  .pdf-report .board-config,
  .pdf-report .module-delete,
  .pdf-report .module-order,
  .pdf-report .module-drag-handle,
  .pdf-report .label-controls {
    display: none !important;
  }

  .pdf-report .item-select-ring,
  .pdf-report .item-hit,
  .pdf-report .cable-hit {
    display: none !important;
  }

  .pdf-report .cable-label {
    display: none !important;
  }
}

@media print {
  @page quote-client {
    size: A4 portrait;
    margin: 12mm;
  }

  body.quote-document-open {
    background: #fff !important;
  }

  body.quote-document-open > :not(#quoteDocumentScreen) {
    display: none !important;
  }

  body.quote-document-open #quoteDocumentScreen {
    position: static;
    display: block !important;
    overflow: visible;
    padding: 0;
    background: #fff;
  }

  body.quote-document-open .quote-document-toolbar {
    display: none !important;
  }

  body.quote-document-open .quote-client-document {
    page: quote-client;
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    box-shadow: none;
  }

  body.quote-document-open .quote-client-lines tr,
  body.quote-document-open .quote-client-section,
  body.quote-document-open .quote-client-totals,
  body.quote-document-open .quote-client-signature {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
