:root {
  --bg: #f5f0e8;
  --panel: rgba(255, 250, 242, 0.9);
  --line: #d5c4ad;
  --text: #2b241d;
  --muted: #74685a;
  --accent: #b65f3a;
  --accent-soft: #f3d4c5;
  --danger: #ad2f2f;
  --shadow: 0 16px 45px rgba(62, 34, 20, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(245, 184, 126, 0.28), transparent 28%),
    radial-gradient(circle at bottom right, rgba(232, 148, 96, 0.18), transparent 24%),
    linear-gradient(135deg, #fff0df 0%, #f7e4d1 100%);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
}

body {
  padding: 9px;
}

body.canvas-fullscreen-active {
  overflow: hidden;
}

body.login-page {
  padding: 24px;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

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

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

input,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(220px, 252px) minmax(0, 1fr);
  min-height: calc(100vh - 120px);
  gap: 9px;
  align-items: start;
}

.app-shell > *,
.main-layout,
.top-right-stack,
.workspace {
  min-width: 0;
}

.app-menubar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  margin-bottom: 9px;
  padding: 6px 16px;
  position: relative;
  z-index: 20;
  background: #fff;
  backdrop-filter: none;
}

.menubar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  background: #fff;
  border-radius: 14px;
  padding: 4px 8px;
}

.brand-logo {
  width: auto;
  height: 34px;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  padding: 0;
  border: 0;
}

.brand-title {
  display: block;
  font-size: 18px;
  line-height: 1.1;
}

.menubar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: 8px;
}

.menubar-account {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.menubar-account-card {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
}

.menubar-account-eyebrow {
  margin-bottom: 0;
  font-size: 8px;
  line-height: 1;
}

.menubar-account-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.menubar-account-name {
  font-size: 14px;
  line-height: 1.1;
}

.menubar-account-role {
  padding: 3px 7px;
  font-size: 11px;
  line-height: 1.1;
}

.logout-form {
  margin: 0;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(182, 95, 58, 0.14);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.role-badge-admin {
  background: rgba(173, 47, 47, 0.14);
  color: var(--danger);
}

.menu-dropdown {
  position: relative;
}

.menu-trigger {
  list-style: none;
  cursor: pointer;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  font-weight: 700;
  font-size: 13px;
  user-select: none;
}

.menu-trigger::-webkit-details-marker {
  display: none;
}

.menu-dropdown-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  display: grid;
  gap: 8px;
  min-width: 220px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 250, 242, 0.98);
  box-shadow: 0 18px 40px rgba(62, 34, 20, 0.18);
  backdrop-filter: blur(12px);
}

.menu-item {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.menu-file-item {
  min-height: 42px;
}

.library-admin-page {
  min-height: 100vh;
  padding: 9px;
}

.login-shell {
  min-height: calc(100vh - 48px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(460px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand-logo {
  height: 44px;
}

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

.login-copy h1 {
  margin: 0;
  font-size: 28px;
}

.login-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.library-admin-shell {
  padding: 20px;
  align-content: start;
}

.library-admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 9px;
  margin-top: 9px;
  align-items: start;
}

.library-admin-grid > * {
  align-self: start;
  min-width: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  align-self: start;
  min-height: auto;
}

.panel-header,
.section-title,
.workspace-toolbar,
.canvas-toolbar,
.inline-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.canvas-toolbar {
  position: sticky;
  top: 8px;
  z-index: 30;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  padding: 8px;
  border: 1px solid rgba(128, 83, 63, 0.16);
  border-radius: 18px;
  background: rgba(255, 250, 242, 0.94);
  box-shadow: 0 10px 22px rgba(82, 53, 37, 0.1);
  backdrop-filter: blur(8px);
}

.canvas-toolbar-menu {
  position: relative;
}

.canvas-toolbar .ghost-button,
.canvas-toolbar .menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  font-size: 0.7em;
  line-height: 1.15;
  background: #ffdca8;
  color: #000000;
  border-color: #e7ae4f;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.canvas-toolbar .menu-trigger {
  font-weight: 700;
}

.canvas-toolbar-trigger::after {
  content: "▾";
  margin-left: 6px;
  font-size: 10px;
  line-height: 1;
}

.canvas-toolbar-menu[open] > .canvas-toolbar-trigger::after {
  content: "▴";
}

.canvas-toolbar .ghost-button:hover,
.canvas-toolbar .menu-trigger:hover {
  background: #ffc56d;
  color: #000000;
  border-color: #d98a12;
}

.canvas-toolbar .ghost-button.danger,
.canvas-toolbar-menu.active > .canvas-toolbar-trigger {
  background: #ff9a03;
  color: #000000;
  border-color: #8a4900;
  box-shadow: 0 0 0 2px rgba(138, 73, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.canvas-toolbar .ghost-button.danger:hover {
  background: #f08f00;
  color: #000000;
  border-color: #743d00;
}

.canvas-toolbar-menu-panel {
  top: calc(100% + 8px);
  min-width: 196px;
  padding: 8px;
  gap: 6px;
  border-radius: 16px;
}

.canvas-toolbar-action {
  display: flex;
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.wrap-actions {
  flex-wrap: wrap;
}

.library-admin-header-actions {
  justify-content: flex-end;
  align-items: center;
}

.library-admin-modal-actions {
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.library-admin-action-row {
  justify-content: flex-start;
  align-items: flex-start;
  gap: 8px;
}

.library-admin-action-row--compact {
  row-gap: 6px;
}

.library-admin-action-row--compact .ghost-button {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.1;
  white-space: nowrap;
}

.library-admin-action-row--left {
  width: 100%;
  justify-content: flex-start;
}

.library-admin-embedded .library-admin-shell-header {
  display: none;
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-size: 9px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

.stack {
  display: grid;
  gap: 6px;
}

.grow {
  min-height: 0;
  flex: 1;
}

.library-list,
.bom-table {
  display: grid;
  gap: 5px;
  min-height: 0;
  overflow: auto;
}

.library-list {
  font-size: 0.8rem;
}

.stations-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 0;
  flex: 0 0 auto;
}

.station-card,
.item-card,
.bom-row {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.65);
}

.tree-section {
  display: grid;
  gap: 4px;
}

.tree-details {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.65);
  padding: 6px;
}

.tree-details + .tree-details {
  margin-top: 4px;
}

.tree-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

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

.category-summary {
  font-size: 14px;
  font-weight: 700;
  padding: 3px 5px;
}

.group-summary {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 5px;
}

.tree-section.nested {
  margin-left: 6px;
}

.tree-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  text-align: left;
}

.tree-toggle:hover {
  border-color: var(--accent);
}

.tree-toggle.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(182, 95, 58, 0.35);
}

.category-toggle {
  font-size: 18px;
  font-weight: 700;
}

.group-toggle {
  font-size: 15px;
  font-weight: 600;
}

.tree-caret {
  width: 18px;
  color: var(--accent);
  flex: 0 0 auto;
}

.tree-count {
  margin-left: auto;
  min-width: 28px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  text-align: center;
}

.tree-key {
  color: var(--muted);
  font-weight: 400;
}

.tree-children {
  display: grid;
  gap: 4px;
}

.tree-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
}

.tree-row .tree-toggle {
  flex: 1;
}

.tree-action {
  flex: 0 0 auto;
  padding: 10px 12px;
}

.station-card.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.station-card {
  display: grid;
  gap: 8px;
  min-width: 180px;
  max-width: 230px;
  padding: 8px 10px;
  text-align: left;
  color: var(--text);
  align-content: start;
}

.station-card-main {
  display: grid;
  gap: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.station-card-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.station-card-markup {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.station-card-markup-label {
  font-size: 10px;
  line-height: 1.2;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.station-card-markup-value {
  font-size: 13px;
  line-height: 1.2;
  color: var(--text);
}

.station-card-properties-btn {
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.1;
  white-space: nowrap;
}

.station-card-tag {
  font-size: 16px;
  line-height: 1.2;
}

.station-card-name {
  font-size: 13px;
  line-height: 1.25;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.group-card h3,
.item-card h4 {
  margin: 0 0 8px;
}

.library-list .item-card h4 {
  font-size: 0.7rem;
}

.item-card {
  cursor: pointer;
}

.item-card:hover {
  border-color: var(--accent);
}

.library-item {
  display: block;
  width: 100%;
  color: var(--text);
  text-align: left;
  touch-action: none;
  user-select: none;
  font-size: 0.7rem;
}

.inset-panel {
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid var(--line);
}

.editor-grid {
  display: grid;
  gap: 12px;
}

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

.table-editor {
  display: grid;
  gap: 8px;
}

.table-editor-header,
.table-editor-row {
  display: grid;
  grid-template-columns: 1.2fr 0.7fr 1fr auto;
  gap: 8px;
  align-items: center;
}

.table-editor-header {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.table-editor-row button {
  padding: 10px 12px;
}

.editor-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.editor-note {
  font-size: 13px;
  color: var(--muted);
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.checkbox-line input {
  width: auto;
}

.item-meta,
.meta-box,
.placeholder {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.status-box.is-error {
  color: var(--danger);
}

.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "top-right"
    "workspace";
  gap: 9px;
  align-self: start;
  align-content: start;
}

.workspace {
  padding: 20px;
}

.top-right-stack {
  grid-area: top-right;
  display: grid;
  gap: 9px;
  align-self: start;
}

.workspace {
  grid-area: workspace;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 7px;
  align-self: start;
  min-height: calc(100vh - 120px);
}

.workspace.is-fullscreen,
.workspace:fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  padding: 12px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  border-radius: 0;
  background: rgba(255, 250, 242, 0.98);
  box-shadow: none;
}

.workspace.is-fullscreen .canvas-toolbar,
.workspace:fullscreen .canvas-toolbar {
  position: relative;
  top: auto;
  z-index: 2;
}

.workspace.is-fullscreen .canvas,
.workspace:fullscreen .canvas {
  height: 100%;
  min-height: 0;
  border-radius: 16px;
}

.bom-panel-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-top: 7px;
}

.bom-panel-content > .stack {
  width: 100%;
}

.stations-panel {
  padding: 8px 14px;
}

.stations-panel-content {
  display: grid;
  grid-template-columns: auto;
  gap: 7px;
  align-items: start;
}

.collapsible-panel {
  padding: 3px 12px;
}

.summary-title {
  cursor: pointer;
  list-style: none;
  min-height: 16px;
  padding: 0;
  justify-content: flex-start;
  align-items: center;
  gap: 0;
}

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

.collapsible-content {
  margin-top: 4px;
}

.project-data-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 16px;
}

#project-data-panel label {
  font-size: 11.2px;
}

#project-data-panel input {
  font-size: 11.2px;
  padding: 8px 10px;
}

.compact-summary-title {
  font-size: 12px;
}

#project-data-panel .summary-title,
.bom-panel .summary-title,
.stations-panel .summary-title {
  min-height: 14px;
}

#project-data-panel .summary-title span,
.bom-panel .summary-title span,
.stations-panel .summary-title span {
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
}

.stations-panel .summary-title span {
  font-size: 11px;
}

.summary-title::before {
  content: "▸";
  font-size: 10px;
  color: var(--muted);
  margin-right: 6px;
  transform: translateY(-1px);
  flex: 0 0 auto;
}

details[open] > .summary-title::before {
  content: "▾";
}

.summary-title span {
  flex: 0 1 auto;
  text-align: left;
}

.library-search-wide {
  width: 100%;
  font-size: 0.8rem;
}

.library-list .item-meta {
  font-size: 0.7rem;
  line-height: 1.2;
}

.library-admin-button {
  width: 100%;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border: 1px solid rgba(182, 95, 58, 0.35);
  font-weight: 700;
}

.library-admin-button:hover {
  background: #c96d45;
}

.picker-button {
  width: 100%;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border: 1px solid rgba(182, 95, 58, 0.35);
  font-weight: 700;
}

.picker-button:hover {
  background: #c96d45;
  color: #fff;
}

.bom-panel-content .stack {
  align-content: start;
}

.bom-table {
  gap: 10px;
}

.bom-station-section {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.bom-station-summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.bom-station-summary::-webkit-details-marker {
  display: none;
}

.bom-station-title {
  font-weight: 700;
}

.bom-station-meta {
  font-size: 0.74rem;
  color: var(--muted);
  text-align: right;
}

.bom-station-content {
  padding: 0 14px 14px;
}

.bom-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.bom-data-table th,
.bom-data-table td {
  padding: 9px 10px;
  border-top: 1px solid rgba(128, 83, 63, 0.14);
  vertical-align: top;
  text-align: left;
}

.bom-data-table thead th {
  background: rgba(244, 225, 211, 0.72);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bom-data-table tbody tr:nth-child(even) {
  background: rgba(255, 249, 244, 0.6);
}

.bom-data-table tfoot td {
  font-weight: 700;
  background: rgba(236, 223, 211, 0.7);
}

.bom-item-name-button {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: context-menu;
}

.bom-item-name-button:hover {
  color: var(--accent);
}

.bom-price-button {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.bom-price-button:hover {
  color: var(--accent);
}

.bom-grand-total {
  border: 1px solid rgba(128, 83, 63, 0.18);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 251, 247, 0.92) 0%, rgba(244, 225, 211, 0.88) 100%);
  padding: 14px;
  display: grid;
  gap: 6px;
  font-size: 0.7em;
  line-height: 1.25;
}

.canvas {
  --canvas-zoom: 1;
  position: relative;
  height: clamp(320px, calc(100vh - 190px), 720px);
  min-height: 320px;
  overflow: scroll;
  scrollbar-gutter: stable both-edges;
  overscroll-behavior: contain;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.canvas::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

.canvas::-webkit-scrollbar-track {
  background: #f3e7d8;
  border-radius: 999px;
}

.canvas::-webkit-scrollbar-thumb {
  background: #b65f3a;
  border: 4px solid #f3e7d8;
  border-radius: 999px;
}

.canvas::-webkit-scrollbar-corner {
  background: #f3e7d8;
}

.canvas-stage {
  position: relative;
  min-width: 100%;
  min-height: 100%;
  background:
    linear-gradient(rgba(214, 196, 173, 0.24) 1px, transparent 1px),
    linear-gradient(90deg, rgba(214, 196, 173, 0.24) 1px, transparent 1px),
    linear-gradient(rgba(214, 196, 173, 0.42) 1px, transparent 1px),
    linear-gradient(90deg, rgba(214, 196, 173, 0.42) 1px, transparent 1px),
    #ffffff;
  background-size:
    calc(5px * var(--canvas-zoom)) calc(5px * var(--canvas-zoom)),
    calc(5px * var(--canvas-zoom)) calc(5px * var(--canvas-zoom)),
    calc(25px * var(--canvas-zoom)) calc(25px * var(--canvas-zoom)),
    calc(25px * var(--canvas-zoom)) calc(25px * var(--canvas-zoom)),
    auto;
}

.canvas-stage-inner {
  position: absolute;
  inset: 0 auto auto 0;
  transform-origin: top left;
}

.pipe-layer,
.element-layer {
  position: absolute;
  inset: 0;
}

.pipe-layer {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.canvas-zoom-controls {
  position: sticky;
  right: 8px;
  z-index: 1;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  min-height: 38px;
  border: 1px solid rgba(128, 83, 63, 0.28);
  border-radius: 16px;
  background: rgba(255, 250, 242, 0.52);
}

.canvas-zoom-button {
  min-width: 38px;
  min-height: 36px;
  padding: 0 10px;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.canvas-toolbar .canvas-zoom-button {
  padding: 0 12px;
  min-height: 36px;
  font-size: 1.4em;
  font-weight: 900;
  line-height: 1;
}

.canvas-zoom-label {
  min-width: 48px;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 700;
  color: #55392a;
}

.element-node {
  position: absolute;
  min-width: 140px;
  max-width: 200px;
  padding: 10px 12px;
  border: 1px solid #80533f;
  border-radius: 18px;
  background: linear-gradient(180deg, #fffdf9 0%, #f4e1d3 100%);
  box-shadow: 0 12px 25px rgba(82, 53, 37, 0.18);
  cursor: grab;
  user-select: none;
  transform-origin: top left;
  will-change: transform;
}

.element-layer {
  overflow: visible;
  pointer-events: none;
}

.multi-select-marquee {
  position: absolute;
  z-index: 20;
  border: 1px solid rgba(255, 154, 3, 0.9);
  border-radius: 8px;
  background: rgba(255, 154, 3, 0.16);
  box-shadow: 0 0 0 1px rgba(116, 61, 0, 0.12);
  pointer-events: none;
}

.element-node,
.connection-handle {
  pointer-events: auto;
}

.element-node.selected {
  outline: 3px solid rgba(182, 95, 58, 0.28);
}

.element-node.dragging {
  cursor: grabbing;
  z-index: 5;
}

.element-node.symbol-only-node {
  min-width: auto;
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.element-node.symbol-only-node .element-tag {
  margin-bottom: 4px;
}

.element-tag {
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.element-title {
  margin-top: 6px;
  font-weight: 700;
}

.element-symbol {
  display: block;
  margin: 4px 0 6px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.element-node.symbol-only-node .element-symbol {
  margin: 0;
}

.connection-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid #80533f;
  border-radius: 999px;
  background: #fff8f2;
  box-shadow: 0 3px 10px rgba(82, 53, 37, 0.18);
  cursor: crosshair;
  padding: 0;
  z-index: 2;
}

.connection-handle:hover,
.connection-handle.active,
.connection-handle.target {
  background: #b65f3a;
  border-color: #b65f3a;
}

.connection-handle.target {
  transform: scale(1.15);
}

.connection-handle[data-side="top"] {
  top: -8px;
  left: calc(50% - 7px);
}

.connection-handle[data-side="right"] {
  top: calc(50% - 7px);
  right: -8px;
}

.connection-handle[data-side="bottom"] {
  bottom: -8px;
  left: calc(50% - 7px);
}

.connection-handle[data-side="left"] {
  top: calc(50% - 7px);
  left: -8px;
}

.element-node.symbol-only-node .connection-handle[data-side="top"] {
  top: -10px;
}

.element-node.symbol-only-node .connection-handle[data-side="right"] {
  right: -10px;
}

.element-node.symbol-only-node .connection-handle[data-side="bottom"] {
  bottom: -10px;
}

.element-node.symbol-only-node .connection-handle[data-side="left"] {
  left: -10px;
}

.pipe-path {
  fill: none;
  stroke: #7b5536;
  stroke-linejoin: round;
  stroke-linecap: round;
  pointer-events: none;
}

.pipe-path.interactive {
  pointer-events: visibleStroke;
  cursor: context-menu;
}

.pipe-path.selected {
  stroke: #b65f3a;
  filter: drop-shadow(0 0 4px rgba(182, 95, 58, 0.35));
}

.pipe-path-dashed {
  stroke-dasharray: 10 8;
}

.pipe-path-dotted {
  stroke-dasharray: 2 9;
  stroke-linecap: round;
}

.pipe-path-preview {
  stroke: #b65f3a;
  stroke-dasharray: 8 6;
  opacity: 0.8;
}

.pipe-bend-handle {
  fill: #fff8f2;
  stroke: #7b5536;
  stroke-width: 2;
  cursor: move;
  pointer-events: all;
  touch-action: none;
  filter: drop-shadow(0 2px 6px rgba(82, 53, 37, 0.18));
}

.pipe-bend-handle.auto {
  opacity: 0.72;
}

.pipe-bend-handle.manual,
.pipe-bend-handle:hover,
.pipe-bend-handle.dragging {
  fill: #b65f3a;
  stroke: #b65f3a;
  opacity: 1;
}

.junction-node {
  pointer-events: all;
}

.junction-hit-area {
  fill: transparent;
  cursor: move;
  pointer-events: all;
}

.junction-dot {
  fill: #111111;
  pointer-events: none;
}

.junction-node.selected .junction-hit-area {
  fill: rgba(182, 95, 58, 0.08);
  stroke: rgba(182, 95, 58, 0.45);
  stroke-width: 2px;
}

.junction-node.selected .junction-dot {
  fill: #b65f3a;
  filter: drop-shadow(0 0 4px rgba(182, 95, 58, 0.35));
}

.ghost-button,
.file-button {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  border: 1px solid var(--line);
}

.danger {
  background: var(--danger);
  color: white;
}

.wide-button {
  width: 100%;
}

.admin-link {
  display: inline-flex;
  justify-content: center;
  text-decoration: none;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
}

#station-template-binding-modal {
  z-index: 2300;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(43, 36, 29, 0.35);
  backdrop-filter: blur(4px);
}

.modal-window {
  position: relative;
  z-index: 1;
  width: min(1460px, calc(100vw - 40px));
  height: min(920px, calc(100vh - 40px));
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.modal-frame {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.65);
}

.picker-modal-window {
  width: min(1380px, calc(100vw - 40px));
  height: min(880px, calc(100vh - 40px));
}

.template-modal-window {
  width: min(760px, calc(100vw - 40px));
  height: min(680px, calc(100vh - 40px));
}

.proposal-template-editor-window {
  width: min(1040px, calc(100vw - 40px));
  height: min(860px, calc(100vh - 40px));
}

.proposal-block-editor-window {
  width: min(980px, calc(100vw - 40px));
  height: min(820px, calc(100vh - 40px));
}

.proposal-block-editor-window .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
}

.proposal-block-editor-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.project-modal-window {
  width: min(860px, calc(100vw - 40px));
  height: min(720px, calc(100vh - 40px));
}

.damper-calculation-modal-window {
  width: min(1280px, calc(100vw - 40px));
  height: min(900px, calc(100vh - 40px));
}

.project-confirm-modal-window {
  width: min(560px, calc(100vw - 40px));
  height: auto;
  min-height: 0;
}

.save-template-modal-window {
  width: min(520px, calc(100vw - 40px));
  height: auto;
  min-height: 0;
}

.admin-users-modal-window {
  width: min(980px, calc(100vw - 40px));
  height: min(720px, calc(100vh - 40px));
}

.admin-users-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
  align-items: start;
}

.admin-users-form,
.admin-users-list {
  display: grid;
  gap: 12px;
}

.admin-users-form-panel,
.admin-users-list-panel {
  align-self: start;
  align-content: start;
}

.admin-users-list {
  align-content: start;
  overflow: auto;
  padding-right: 6px;
}

.admin-user-card {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid rgba(128, 83, 63, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
}

.admin-user-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-user-card h3 {
  margin: 0;
  font-size: 17px;
}

.admin-user-card-meta {
  display: grid;
  gap: 4px;
}

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

.admin-user-card-actions button {
  padding: 7px 11px;
}

.admin-user-password-form {
  display: grid;
  gap: 10px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid rgba(128, 83, 63, 0.12);
}

.admin-user-password-form label {
  gap: 5px;
}

.admin-user-password-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.project-confirm-content,
.save-template-form {
  display: grid;
  gap: 14px;
}

.project-modal-content,
.template-modal-content,
.project-registry-content {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

.project-registry-modal-window {
  width: min(1120px, calc(100vw - 40px));
}

.template-modal-content {
  grid-template-rows: auto minmax(0, 1fr);
}

.proposal-template-editor-content {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.damper-calculation-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

.damper-calculation-sidebar,
.damper-calculation-main {
  display: grid;
  gap: 14px;
  min-height: 0;
  align-content: start;
  overflow: hidden;
}

.damper-calculation-sidebar {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.damper-calculation-main {
  grid-template-rows: auto minmax(0, 1fr);
}

.damper-calculation-main-scroll {
  display: grid;
  gap: 14px;
  min-height: 0;
  align-content: start;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  scrollbar-gutter: stable;
}

.damper-calculation-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.damper-calculation-fields label:nth-child(1),
.damper-calculation-fields label:nth-child(2),
.damper-calculation-fields label:nth-child(3),
.damper-calculation-fields label:nth-child(10),
.damper-calculation-fields label:nth-child(11) {
  grid-column: 1 / -1;
}

.damper-calculation-hint,
.damper-slider-meta {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(128, 83, 63, 0.12);
  border-radius: 16px;
  padding: 12px 14px;
}

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

.damper-summary-card,
.damper-slider-card,
.damper-chart-card {
  border: 1px solid rgba(128, 83, 63, 0.14);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.58);
}

.damper-summary-card {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
}

.damper-summary-label {
  color: var(--muted);
  font-size: 13px;
}

.damper-summary-value {
  font-size: 28px;
  line-height: 1;
}

.damper-slider-card,
.damper-chart-card {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
}

.damper-chart-head {
  align-items: center;
  flex-wrap: wrap;
}

.damper-chart-head .ghost-button {
  min-height: 36px;
  padding: 8px 14px;
  white-space: nowrap;
}

.damper-slider-card input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.damper-chart-frame {
  min-height: 0;
  height: 420px;
  border-radius: 18px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(246, 235, 223, 0.9));
  border: 1px solid rgba(128, 83, 63, 0.12);
}

.damper-chart-svg {
  display: block;
  width: 100%;
  height: 420px;
}

.proposal-template-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}

.proposal-template-tab {
  min-height: 34px;
  padding: 6px 14px;
  border: 1px solid rgba(128, 83, 63, 0.18);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.9);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.proposal-template-tab:hover {
  background: rgba(255, 244, 234, 0.98);
  color: var(--text);
}

.proposal-template-tab.is-active {
  border-color: rgba(182, 95, 58, 0.42);
  background: rgba(182, 95, 58, 0.14);
  color: #8f4425;
  box-shadow: inset 0 0 0 1px rgba(182, 95, 58, 0.08);
}

.proposal-template-tab:focus-visible {
  outline: 2px solid rgba(182, 95, 58, 0.4);
  outline-offset: 2px;
}

.proposal-template-sections {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.proposal-template-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  min-height: 0;
  height: 100%;
  padding: 12px;
  overflow: hidden;
  border-radius: 16px;
}

.proposal-template-section[hidden] {
  display: none;
}

.proposal-template-section.inset-panel {
  padding: 12px;
}

.proposal-template-section-head {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.proposal-template-section-head--with-actions {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.proposal-template-section-head h3 {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.2;
}

.proposal-template-section-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  min-height: 0;
  flex: 1 1 auto;
}

.proposal-template-section--documents > .proposal-template-section-body {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  position: relative;
  gap: 6px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.proposal-template-section--mapping > .proposal-template-section-body,
.proposal-template-section--blocks > .proposal-template-section-body {
  align-items: stretch;
}

.proposal-template-section--documents.proposal-template-section--scrollable::before {
  content: "";
  position: absolute;
  top: var(--proposal-scroll-track-top, 0px);
  right: 3px;
  width: 12px;
  height: var(--proposal-scroll-track-height, 0px);
  border-radius: 999px;
  background: rgba(226, 205, 190, 0.96);
  box-shadow: inset 0 0 0 1px rgba(111, 62, 44, 0.18);
  pointer-events: none;
  z-index: 1;
}

.proposal-template-section--documents.proposal-template-section--scrollable::after {
  content: "";
  position: absolute;
  top: calc(var(--proposal-scroll-track-top, 0px) + var(--proposal-scroll-thumb-top, 0px));
  right: 4px;
  width: 10px;
  height: var(--proposal-scroll-thumb-height, 48px);
  border-radius: 999px;
  background: #b65f3a;
  box-shadow: 0 1px 2px rgba(62, 34, 20, 0.18);
  pointer-events: none;
  z-index: 2;
}

.proposal-template-section-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

.proposal-template-upload-button {
  width: fit-content;
  max-width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  white-space: nowrap;
  align-self: start;
  border-radius: 12px;
  font-size: 0.78rem;
}

.proposal-template-list {
  min-height: 0;
  width: 100%;
  max-height: min(40vh, 320px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.proposal-template-section--documents .proposal-template-list {
  display: grid;
  align-content: start;
  min-height: 0;
  max-height: none;
  overflow: visible;
  box-sizing: border-box;
  padding-right: 18px;
}

.proposal-template-section--mapping .proposal-mapping-table-wrap {
  flex: 1 1 auto;
  max-height: none;
}

.proposal-template-section--blocks .placeholder {
  width: 100%;
}

.proposal-template-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.15;
}

.proposal-template-card-meta span {
  overflow-wrap: anywhere;
}

.proposal-template-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title actions"
    "meta actions";
  align-items: center;
  gap: 4px 10px;
  min-height: 84px;
  max-height: 100px;
  padding: 6px 10px;
  border-radius: 12px;
  overflow: hidden;
}

.proposal-template-card .template-card-header {
  grid-area: title;
  gap: 4px;
  min-width: 0;
}

.proposal-template-card strong {
  display: block;
  font-size: 0.8rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.proposal-template-card .proposal-template-card-meta {
  grid-area: meta;
  min-width: 0;
}

.proposal-template-card .template-card-actions {
  grid-area: actions;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  justify-content: center;
}

.proposal-template-card .template-card-actions button {
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 9px;
  font-size: 0.68rem;
  line-height: 1.1;
  white-space: nowrap;
}

.proposal-mapping-table-wrap {
  overflow: auto;
  width: 100%;
  max-height: min(36vh, 320px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  scrollbar-gutter: stable;
}

.proposal-mapping-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.proposal-mapping-table th,
.proposal-mapping-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(128, 83, 63, 0.14);
  vertical-align: top;
  text-align: left;
}

.proposal-mapping-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(111, 62, 44, 0.96);
  color: white;
  font-size: 0.76rem;
}

.proposal-mapping-table tbody tr:nth-child(even) {
  background: rgba(255, 246, 236, 0.72);
}

.proposal-mapping-code {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(244, 225, 211, 0.72);
  color: #6f3e2c;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.74rem;
  font-weight: 700;
}

.proposal-mapping-muted {
  color: var(--muted);
}

.proposal-template-list::-webkit-scrollbar,
.proposal-mapping-table-wrap::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.proposal-template-list::-webkit-scrollbar-track,
.proposal-mapping-table-wrap::-webkit-scrollbar-track {
  background: #f3e7d8;
  border-radius: 999px;
}

.proposal-template-list::-webkit-scrollbar-thumb,
.proposal-mapping-table-wrap::-webkit-scrollbar-thumb {
  background: #b65f3a;
  border: 3px solid #f3e7d8;
  border-radius: 999px;
}

.proposal-template-list::-webkit-scrollbar-corner,
.proposal-mapping-table-wrap::-webkit-scrollbar-corner {
  background: #f3e7d8;
}

.proposal-template-section--documents > .proposal-template-section-body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.project-registry-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.project-registry-toolbar button {
  min-height: 38px;
  white-space: nowrap;
}

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

.project-search-grid label {
  font-size: 0.78rem;
}

.project-search-grid input {
  padding: 8px 10px;
  border-radius: 10px;
}

.project-list,
.template-list {
  display: grid;
  gap: 6px;
  align-content: start;
  overflow: auto;
  padding-right: 4px;
}

.project-registry-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
}

.project-registry-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.project-registry-table th,
.project-registry-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(128, 83, 63, 0.16);
  text-align: left;
  vertical-align: top;
}

.project-registry-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(111, 62, 44, 0.96);
  color: white;
  font-size: 0.76rem;
}

.project-registry-table tbody tr:nth-child(even) {
  background: rgba(255, 246, 236, 0.72);
}

.project-registry-table .numeric-cell {
  text-align: right;
  white-space: nowrap;
}

.registry-empty-cell {
  color: var(--muted);
  text-align: center;
}

.template-card {
  display: grid;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  text-align: left;
  box-shadow: none;
}

.project-card {
  display: grid;
  grid-template-columns: minmax(170px, 0.8fr) minmax(120px, 0.7fr) minmax(180px, 1fr) minmax(170px, auto);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  text-align: left;
  box-shadow: none;
}

.project-card:hover,
.template-card:hover {
  background: rgba(255, 246, 236, 0.96);
}

.project-card strong,
.template-card strong {
  font-size: 0.95rem;
}

.project-card-header,
.template-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.project-card-header {
  display: contents;
}

.project-card-header strong,
.template-card-header strong {
  overflow-wrap: anywhere;
}

.project-card-header strong {
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-card-header span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.project-card-meta {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-card .template-card-actions {
  justify-content: flex-end;
}

.project-card .template-card-actions button {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 0.78rem;
}

.template-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.template-card-actions button {
  padding: 8px 12px;
}

.template-rename-form {
  display: grid;
  gap: 10px;
}

.template-delete-confirm {
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 700;
}

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

.template-card.proposal-template-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title actions"
    "meta actions";
  align-items: center;
  gap: 1px 8px;
  min-height: 40px;
  max-height: 48px;
  padding: 4px 8px;
  border-radius: 10px;
  overflow: hidden;
}

.template-card.proposal-template-card .template-card-header {
  grid-area: title;
  min-width: 0;
}

.template-card.proposal-template-card strong {
  display: block;
  font-size: 0.74rem;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-card.proposal-template-card .proposal-template-card-meta {
  grid-area: meta;
  display: block;
  min-width: 0;
  font-size: 0.62rem;
  line-height: 1;
}

.template-card.proposal-template-card .proposal-template-card-meta span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-card.proposal-template-card .template-card-actions {
  grid-area: actions;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  flex-wrap: nowrap;
}

.template-card.proposal-template-card .template-card-actions button {
  min-height: 20px;
  padding: 1px 6px;
  border-radius: 7px;
  font-size: 0.58rem;
  line-height: 1;
}

.template-card.proposal-template-card > .template-rename-form {
  grid-column: 1 / -1;
}

.template-card.proposal-template-card > .template-delete-confirm {
  grid-area: meta;
}

.template-card.proposal-image-template-card {
  grid-template-columns: 112px minmax(0, 1fr) auto;
  grid-template-areas:
    "preview title actions"
    "preview meta actions"
    "preview codes actions";
  align-items: start;
  min-height: 116px;
  max-height: none;
  gap: 4px 8px;
}

.proposal-image-template-preview-wrap {
  grid-area: preview;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 112px;
  min-height: 100px;
  padding: 6px;
  border-radius: 10px;
  background: rgba(250, 241, 233, 0.92);
  overflow: hidden;
}

.proposal-image-template-preview {
  display: block;
  width: 100%;
  height: 100px;
  object-fit: contain;
}

.template-card.proposal-image-template-card .proposal-template-card-meta {
  font-size: 0.64rem;
  line-height: 1.15;
}

.proposal-template-code-row {
  grid-area: codes;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  min-width: 0;
}

.proposal-template-inline-code {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(244, 225, 211, 0.72);
  color: #6f3e2c;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1;
}

.proposal-image-template-form {
  gap: 5px;
}

.proposal-image-template-form .quick-edit-label {
  gap: 3px;
}

.proposal-image-template-form .quick-edit-label > span {
  font-size: 0.68rem;
  line-height: 1.1;
}

.proposal-image-template-form .quick-edit-input {
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  line-height: 1.1;
}

.proposal-image-template-form .template-card-actions {
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.proposal-image-template-form .template-card-actions button {
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 8px;
  font-size: 0.64rem;
  line-height: 1;
}

.template-card.proposal-block-template-card {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title actions"
    "meta actions"
    "codes actions"
    "preview actions";
  align-items: start;
  min-height: 132px;
  max-height: none;
  gap: 4px 8px;
}

.proposal-block-template-preview {
  grid-area: preview;
  min-width: 0;
  min-height: 48px;
  max-height: 74px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(250, 241, 233, 0.68);
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.35;
  overflow: hidden;
}

.proposal-block-editor-content {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 0;
}

.proposal-block-editor-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.proposal-block-editor-fields .quick-edit-input {
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 10px;
}

.proposal-block-editor-editor {
  min-height: 0;
}

.proposal-block-editor-source {
  display: none;
}

.proposal-block-editor-editor .sun-editor {
  border-color: rgba(128, 83, 63, 0.18);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
  min-height: 0;
}

.proposal-block-editor-editor .sun-editor .se-toolbar {
  background: rgba(255, 250, 242, 0.92);
  border-bottom-color: rgba(128, 83, 63, 0.12);
}

.proposal-block-editor-editor .sun-editor .se-wrapper {
  min-height: 420px;
}

.proposal-block-editor-editor .sun-editor .se-wrapper .se-wrapper-inner {
  min-height: 420px;
}

.proposal-block-editor-editor .sun-editor .sun-editor-editable {
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.proposal-block-editor-editor .sun-editor .sun-editor-editable table {
  width: 100%;
}

.proposal-block-editor-editor .sun-editor .sun-editor-editable td,
.proposal-block-editor-editor .sun-editor .sun-editor-editable th {
  border-color: #d3b69c;
  padding: 6px 8px;
}

.proposal-block-editor-surface {
  min-height: 0;
  padding: 16px;
  border: 1px solid rgba(128, 83, 63, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  overflow: auto;
  outline: none;
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.proposal-block-editor-surface:focus {
  border-color: rgba(182, 95, 58, 0.42);
  box-shadow: 0 0 0 3px rgba(182, 95, 58, 0.12);
}

.proposal-block-editor-surface > :first-child {
  margin-top: 0;
}

.proposal-block-editor-surface > :last-child {
  margin-bottom: 0;
}

.proposal-block-editor-surface p,
.proposal-block-editor-surface ul,
.proposal-block-editor-surface ol,
.proposal-block-editor-surface blockquote,
.proposal-block-editor-surface table,
.proposal-block-editor-surface h1,
.proposal-block-editor-surface h2,
.proposal-block-editor-surface h3,
.proposal-block-editor-surface h4 {
  margin: 0 0 10px;
}

.proposal-block-editor-surface table {
  width: 100%;
  border-collapse: collapse;
}

.proposal-block-editor-surface th,
.proposal-block-editor-surface td {
  min-width: 72px;
  border: 1px solid #d3b69c;
  padding: 6px 8px;
  vertical-align: top;
}

.proposal-block-editor-surface th {
  background: rgba(244, 225, 211, 0.62);
}

.proposal-block-editor-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.proposal-block-editor-footer .template-card-actions {
  justify-content: flex-end;
}

.proposal-block-editor-status {
  min-height: 0;
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 2400;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 16px;
  border: 1px solid rgba(128, 83, 63, 0.22);
  border-radius: 14px;
  background: rgba(255, 250, 242, 0.98);
  box-shadow: 0 18px 40px rgba(62, 34, 20, 0.2);
  color: var(--text);
  font-weight: 700;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, -8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.picker-layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 14px;
  height: 100%;
  min-height: 0;
  align-items: start;
}

.picker-layout > * {
  min-width: 0;
}

.picker-controls,
.picker-results {
  display: grid;
  min-height: 0;
  max-height: 100%;
  padding: 16px;
  align-self: start;
  align-content: start;
  overflow: hidden;
}

.picker-selects {
  display: grid;
  gap: 10px;
}

.picker-filters,
.picker-results-table {
  display: grid;
  gap: 8px;
  min-height: 0;
}

.picker-controls {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.picker-results {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.picker-filters {
  overflow: auto;
  padding-right: 4px;
}

.picker-results-table {
  overflow-y: auto;
  overflow-x: hidden;
}

.picker-filter-field {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(128, 83, 63, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.48);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.picker-filter-field.is-active {
  border-color: rgba(182, 95, 58, 0.48);
  background: linear-gradient(180deg, rgba(255, 247, 240, 0.94), rgba(247, 230, 216, 0.94));
  box-shadow: inset 0 0 0 1px rgba(182, 95, 58, 0.16);
}

.picker-multiselect {
  position: relative;
}

.picker-multiselect-summary {
  list-style: none;
  cursor: pointer;
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  user-select: none;
  text-align: left;
}

.picker-filter-field.is-active .picker-multiselect-summary {
  border-color: rgba(182, 95, 58, 0.42);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  font-weight: 600;
}

.picker-multiselect-summary::-webkit-details-marker {
  display: none;
}

.picker-multiselect-menu {
  display: grid;
  gap: 6px;
  margin-top: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 250, 242, 0.98);
  text-align: left;
}

.picker-multiselect-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  justify-content: start;
  width: 100%;
  text-align: left;
  padding: 7px 8px;
  border-radius: 12px;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.picker-multiselect-option.is-selected {
  background: rgba(182, 95, 58, 0.12);
  box-shadow: inset 0 0 0 1px rgba(182, 95, 58, 0.16);
}

.picker-multiselect-option input[type="checkbox"] {
  margin: 2px 0 0;
  justify-self: start;
}

.picker-multiselect-option span {
  justify-self: start;
  text-align: left;
}

.picker-multiselect-empty {
  color: var(--muted);
}

.picker-selected-values {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.picker-selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 6px 4px 10px;
  border: 1px solid rgba(182, 95, 58, 0.24);
  border-radius: 999px;
  background: rgba(182, 95, 58, 0.14);
  color: #7b4328;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.2;
}

.picker-selected-chip-label {
  min-width: 0;
}

.picker-selected-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid rgba(123, 67, 40, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: #7b4328;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.picker-selected-chip-remove:hover {
  background: rgba(182, 95, 58, 0.16);
  border-color: rgba(123, 67, 40, 0.28);
  transform: none;
}

.picker-range-filter {
  display: grid;
  gap: 8px;
}

.picker-range-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.picker-range-value-field {
  display: grid;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.picker-range-number {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(128, 83, 63, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  font: inherit;
  line-height: 1.2;
}

.picker-range-number:focus {
  outline: none;
  border-color: rgba(182, 95, 58, 0.58);
  box-shadow: 0 0 0 3px rgba(182, 95, 58, 0.14);
}

.picker-range-slider {
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
}

.picker-range-track,
.picker-range-fill {
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 999px;
}

.picker-range-track {
  background: rgba(128, 83, 63, 0.18);
}

.picker-range-fill {
  right: auto;
  background: var(--accent);
}

.picker-range-input {
  position: absolute;
  left: 0;
  width: 100%;
  width: 100%;
  margin: 0;
  background: transparent;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
}

.picker-range-input::-webkit-slider-runnable-track {
  height: 6px;
  background: transparent;
}

.picker-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(62, 34, 20, 0.18);
  pointer-events: auto;
  cursor: pointer;
}

.picker-range-input::-moz-range-track {
  height: 6px;
  background: transparent;
}

.picker-range-input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(62, 34, 20, 0.18);
  pointer-events: auto;
  cursor: pointer;
}

.picker-range-boundaries {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.72rem;
  color: var(--muted);
}

.picker-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.picker-data-table th,
.picker-data-table td {
  padding: 10px 12px;
  border-top: 1px solid rgba(128, 83, 63, 0.14);
  vertical-align: top;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.picker-data-table thead th {
  background: rgba(244, 225, 211, 0.72);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.picker-data-table th:nth-child(1),
.picker-data-table td:nth-child(1) {
  min-width: 150px;
}

.picker-data-table th:nth-child(3),
.picker-data-table td:nth-child(3) {
  min-width: 150px;
}

.picker-data-table th:nth-child(4),
.picker-data-table td:nth-child(4) {
  min-width: 140px;
}

.picker-data-table thead th:nth-child(1),
.picker-data-table thead th:nth-child(3),
.picker-data-table thead th:nth-child(4) {
  white-space: nowrap;
}

.picker-data-table tbody tr:nth-child(even) {
  background: rgba(255, 249, 244, 0.6);
}

.picker-item-title-button {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.picker-item-title-button:hover {
  color: var(--accent);
}

.library-drag-ghost {
  position: fixed;
  z-index: 2000;
  pointer-events: none;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid #80533f;
  background: linear-gradient(180deg, #fffdf9 0%, #f4e1d3 100%);
  box-shadow: 0 12px 25px rgba(82, 53, 37, 0.18);
  color: var(--text);
  font-weight: 700;
}

.element-context-menu,
.quick-edit-popover {
  position: fixed;
  z-index: 2100;
  min-width: 220px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 250, 242, 0.98);
  box-shadow: 0 18px 40px rgba(62, 34, 20, 0.18);
  backdrop-filter: blur(12px);
}

.element-context-menu {
  display: grid;
  gap: 8px;
}

.context-action-btn {
  width: 100%;
  color: var(--text);
  text-align: left;
}

.context-action-danger {
  border-color: rgba(173, 47, 47, 0.35);
  color: var(--danger);
}

.quick-edit-popover {
  display: grid;
  gap: 10px;
}

.station-edit-popover {
  width: min(420px, calc(100vw - 24px));
  max-height: min(82vh, 760px);
  overflow: auto;
  overscroll-behavior: contain;
}

.station-edit-hint {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.quick-edit-title {
  font-size: 15px;
  font-weight: 700;
}

.quick-edit-label {
  display: grid;
  gap: 6px;
}

.quick-edit-input {
  background: rgba(255, 255, 255, 0.92);
}

.quick-edit-textarea {
  min-height: 96px;
  resize: vertical;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.station-name-textarea {
  min-height: 62px;
}

.station-liquid-textarea {
  min-height: 78px;
}

.station-template-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(128, 83, 63, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
}

.station-template-summary-count {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.station-template-summary-count strong {
  font-size: 0.82rem;
  line-height: 1.2;
}

.station-template-summary-count span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

.station-template-bind-btn {
  flex-shrink: 0;
}

.station-template-binding-modal-window {
  width: calc(100vw - 24px);
  height: calc(100vh - 24px);
  max-width: none;
  max-height: none;
  overscroll-behavior: contain;
}

.station-template-binding-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.station-template-binding-modal-content {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

.station-template-binding-columns {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 14px;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

.station-template-binding-modal-column {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 14px;
}

.station-template-binding-modal-column-head {
  display: grid;
  gap: 8px;
}

.station-template-binding-modal-column-head h3 {
  margin: 0;
  font-size: 1rem;
}

.station-template-binding-modal-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.station-template-binding-search {
  min-height: 38px;
}

.station-template-binding-modal-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  height: 100%;
  align-content: start;
  overflow-y: scroll;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(182, 95, 58, 0.88) rgba(244, 225, 211, 0.52);
  padding-right: 4px;
}

.station-template-binding-modal-list::-webkit-scrollbar {
  width: 10px;
}

.station-template-binding-modal-list::-webkit-scrollbar-track {
  background: rgba(244, 225, 211, 0.52);
  border-radius: 999px;
}

.station-template-binding-modal-list::-webkit-scrollbar-thumb {
  background: rgba(182, 95, 58, 0.88);
  border-radius: 999px;
}

.station-template-binding-modal-list::-webkit-scrollbar-corner {
  background: transparent;
}

.station-template-selected-modal-list {
  display: grid;
  gap: 8px;
  align-content: start;
}

.station-template-drop-slot {
  height: 30px;
  border: 1px dashed rgba(176, 112, 74, 0.26);
  border-radius: 10px;
  background: rgba(255, 247, 239, 0.48);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.station-template-drop-slot--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.station-template-drop-slot.is-drop-target {
  background: rgba(214, 132, 86, 0.16);
  border-color: rgba(176, 112, 74, 0.5);
}

.station-template-selected-modal-card,
.station-template-library-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(128, 83, 63, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  cursor: grab;
}

.station-template-selected-modal-card {
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: start;
  align-self: start;
}

.station-template-selected-modal-card--image {
  grid-template-columns: 34px 92px minmax(0, 1fr) auto;
}

.station-template-library-card--image {
  grid-template-columns: 92px minmax(0, 1fr) 128px;
  align-items: start;
}

.station-template-library-card.is-selected {
  background: rgba(237, 203, 145, 0.18);
}

.station-template-selected-modal-card.is-dragging,
.station-template-library-card.is-dragging {
  opacity: 0.55;
}

.station-template-selected-modal-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 999px;
  background: rgba(244, 225, 211, 0.72);
  color: #6f3e2c;
  font-size: 0.8rem;
  font-weight: 700;
}

.station-template-image-preview-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 92px;
  min-height: 82px;
  padding: 5px;
  border-radius: 10px;
  background: rgba(250, 241, 233, 0.92);
  overflow: hidden;
}

.station-template-image-preview {
  display: block;
  width: 100%;
  height: 72px;
  object-fit: contain;
}

.station-template-selected-modal-body,
.station-template-library-card-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.station-template-selected-modal-topline,
.station-template-library-card-topline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.station-template-selected-modal-body strong,
.station-template-library-card strong {
  font-size: 0.82rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.station-template-selected-modal-body span,
.station-template-library-card-body span,
.station-template-library-card-hint {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.station-template-kind-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
}

.station-template-kind-badge--blocks {
  background: rgba(221, 203, 160, 0.42);
  color: #7b5b29;
}

.station-template-kind-badge--images {
  background: rgba(244, 225, 211, 0.72);
  color: #6f3e2c;
}

.station-template-selected-modal-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.station-template-selected-modal-drag-hint {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.2;
  text-align: right;
}

.station-template-selected-remove-btn {
  white-space: nowrap;
}

.station-template-library-card-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
  align-self: center;
}

.station-template-library-card--image .station-template-library-card-actions {
  width: 128px;
  justify-items: stretch;
  align-self: start;
}

.station-template-library-card-hint {
  text-align: right;
}

.station-template-library-card--image .station-template-library-card-hint {
  max-inline-size: 128px;
}

.station-template-library-add-btn {
  white-space: nowrap;
}

.station-template-library-card--image .station-template-library-add-btn {
  width: 100%;
}

.station-template-empty {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
  padding: 2px 0;
}

.quick-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.drag-debug {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
}

.file-button input {
  display: none;
}

.hidden {
  display: none;
}

.bom-row {
  display: grid;
  gap: 4px;
}

@media (max-width: 1280px) {
  body {
    padding: 12px;
  }

  .app-menubar {
    flex-direction: column;
    align-items: stretch;
  }

  .menubar-nav {
    justify-content: flex-start;
    margin-left: 0;
  }

  .menubar-account {
    margin-left: 0;
    justify-content: flex-start;
  }

  .main-layout {
    grid-template-areas:
      "top-right"
      "workspace";
  }

  .station-fields {
    grid-template-columns: 1fr;
  }

  .station-template-summary {
    flex-direction: column;
    align-items: stretch;
  }

  .station-template-bind-btn {
    width: 100%;
  }

  .station-template-binding-columns {
    grid-template-columns: 1fr;
  }

  .station-template-binding-modal-window {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    padding: 14px;
  }

  .proposal-block-editor-window {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    padding: 14px;
  }

  .proposal-block-editor-window .modal-header {
    flex-direction: column;
    align-items: stretch;
  }

  .proposal-block-editor-header-actions {
    width: 100%;
    justify-content: stretch;
  }

  .proposal-block-editor-header-actions button {
    flex: 1 1 0;
  }

  .proposal-template-section-head--with-actions,
  .proposal-block-editor-fields,
  .proposal-block-editor-footer {
    grid-template-columns: 1fr;
  }

  .station-template-selected-modal-card {
    grid-template-columns: 1fr;
  }

  .station-template-selected-modal-card--image,
  .station-template-library-card--image,
  .template-card.proposal-block-template-card {
    grid-template-columns: 1fr;
  }

  .template-card.proposal-block-template-card {
    grid-template-areas:
      "title"
      "meta"
      "codes"
      "preview"
      "actions";
  }

  .station-template-selected-modal-actions {
    justify-items: stretch;
  }

  .station-template-library-card-actions {
    justify-items: stretch;
  }

  .station-template-selected-remove-btn {
    width: 100%;
  }

  .station-template-library-add-btn {
    width: 100%;
  }

  .stations-panel-content {
    grid-template-columns: 1fr;
  }

  .bom-panel-content {
    grid-template-columns: 1fr;
  }

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

  .bom-station-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .bom-station-meta {
    text-align: left;
  }

  .bom-data-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .picker-modal-window {
    height: min(920px, calc(100vh - 24px));
  }

  .damper-calculation-modal-window {
    height: min(920px, calc(100vh - 24px));
  }

  .damper-calculation-summary,
  .damper-calculation-fields {
    grid-template-columns: 1fr;
  }

  .damper-calculation-fields label:nth-child(1),
  .damper-calculation-fields label:nth-child(2),
  .damper-calculation-fields label:nth-child(3),
  .damper-calculation-fields label:nth-child(10),
  .damper-calculation-fields label:nth-child(11) {
    grid-column: auto;
  }

  .picker-data-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .project-search-grid,
  .project-card {
    grid-template-columns: 1fr;
  }

  .project-card {
    min-height: auto;
  }

  .project-card-header {
    display: flex;
  }

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

  .proposal-template-editor-window {
    height: min(920px, calc(100vh - 24px));
  }

  .admin-users-modal-window {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    padding: 14px;
  }

  .proposal-template-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .proposal-template-tabs::-webkit-scrollbar {
    display: none;
  }

  .proposal-template-tab {
    flex: 0 0 auto;
  }

  .proposal-template-upload-button {
    width: 100%;
    justify-content: center;
  }

  .proposal-template-section,
  .proposal-template-section.inset-panel {
    padding: 10px;
  }

  .proposal-mapping-table {
    min-width: 620px;
  }

  .template-card.proposal-image-template-card {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "preview"
      "title"
      "meta"
      "codes"
      "actions";
  }

  .proposal-image-template-preview-wrap {
    width: 100%;
  }

  .template-card.proposal-image-template-card .template-card-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 1024px) {
  .app-shell,
  .library-admin-grid,
  .admin-users-layout,
  .damper-calculation-layout,
  .picker-layout {
    grid-template-columns: 1fr;
  }
}
