:root {
  --bg: #f5f6f7;
  --panel: #ffffff;
  --panel-raised: #ffffff;
  --line: #c9ced6;
  --line-strong: #8c95a3;
  --text: #1c2430;
  --muted: #5f6b7a;
  --accent: #0f766e;
  --danger: #b42318;
  --focus: #245cc7;
  --header-bg: #202833;
  --header-text: #ffffff;
  --header-muted: #cfd6df;
  --input-bg: #ffffff;
  --tab-bg: #e5e8ec;
  --subtab-bg: #f2f4f6;
  --row-alt: #f7f9fc;
  --row-alt-nested: #eef3f8;
  --row-detail: #f8f9fa;
  --nested-rule: #d6dce3;
  --overlay: rgb(20 24 30 / 55%);
  --banner-bg: #20332f;
  --banner-text: #ffffff;
  --duplicate-bg: #f7c9c5;
  --overload-bg: #f4c7c3;
}

:root[data-theme="dark"] {
  --bg: #151716;
  --panel: #202321;
  --panel-raised: #282b29;
  --line: #4a504d;
  --line-strong: #737c78;
  --text: #eef1ee;
  --muted: #b6beb9;
  --accent: #5ec2b4;
  --danger: #ff8a80;
  --focus: #91b4ff;
  --header-bg: #0f1412;
  --header-text: #f7faf7;
  --header-muted: #aeb9b3;
  --input-bg: #161917;
  --tab-bg: #2b302d;
  --subtab-bg: #252a27;
  --row-alt: #252926;
  --row-alt-nested: #2a2f2c;
  --row-detail: #191d1b;
  --nested-rule: #56615c;
  --overlay: rgb(0 0 0 / 65%);
  --banner-bg: #cfece6;
  --banner-text: #10201c;
  --duplicate-bg: #5a2421;
  --overload-bg: #5b2320;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  font: 13px/1.35 Arial, Helvetica, sans-serif;
  height: 100vh;
  overflow: hidden;
}

[data-authenticated-shell] {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.app-header {
  align-items: center;
  background: var(--header-bg);
  color: var(--header-text);
  display: flex;
  justify-content: space-between;
  min-height: 52px;
  padding: 8px 14px;
  position: sticky;
  top: 0;
  z-index: 80;
}

.app-header h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0;
}

.app-header p {
  color: var(--header-muted);
  margin: 1px 0 0;
}

.header-controls {
  align-items: center;
  display: flex;
  gap: 10px;
}

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

.project-context span {
  color: var(--header-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.header-select {
  background: var(--input-bg);
  border: 1px solid var(--header-muted);
  color: var(--text);
  color-scheme: light dark;
  font: inherit;
  min-height: 28px;
  min-width: 220px;
  padding: 3px 6px;
}

.theme-toggle {
  background: transparent;
  border-color: var(--header-muted);
  color: var(--header-text);
}

.app-shell {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  padding: 10px;
}

.tab-bar {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.tab-button {
  background: var(--tab-bg);
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  min-height: 28px;
  padding: 4px 9px;
}

.tab-button.is-active {
  background: var(--panel);
  border-color: var(--line-strong);
  border-bottom-color: var(--panel);
  font-weight: 700;
}

.subtab-bar {
  background: var(--subtab-bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex: none;
  flex-wrap: wrap;
  gap: 4px;
  padding: 5px 6px 0;
}

.subtab-button {
  background: var(--tab-bg);
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  min-height: 25px;
  padding: 3px 8px;
}

.subtab-button.is-active {
  background: var(--panel);
  border-color: var(--line-strong);
  border-bottom-color: var(--panel);
  font-weight: 700;
}

.workspace {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.catalog-panel {
  display: none;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.catalog-panel.is-active {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.subpanel {
  display: none;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.subpanel.is-active {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.panel-title {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex: none;
  justify-content: space-between;
  min-height: 34px;
  padding: 5px 7px;
}

.panel-title h2 {
  font-size: 14px;
  margin: 0;
}

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

.view-total-indicator {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.settings-grid {
  align-content: start;
  align-items: start;
  flex: 0 0 auto;
  display: grid;
  gap: 10px;
  grid-auto-rows: max-content;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: max-content;
  overflow: visible;
  padding: 10px;
}

.settings-config-subpanel.is-active {
  overflow-x: hidden;
  overflow-y: auto;
}

.settings-card {
  align-self: start;
  background: var(--panel);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  height: max-content;
  min-height: auto;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.settings-card.is-loading-card {
  opacity: 0.72;
}

.settings-card.is-loading-card::after {
  background: var(--tab-bg);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.settings-form {
  display: grid;
  flex: 0 0 auto;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: auto;
  overflow: visible;
  padding: 10px;
}

.settings-card > .table-wrap {
  flex: 0 0 auto;
  min-height: auto;
  overflow-x: auto;
  overflow-y: visible;
}

.settings-form label {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.settings-form span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.settings-actions {
  display: flex;
  gap: 6px;
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.export-filter-checkbox {
  align-items: center;
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.export-filter-checkbox span {
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
}

.import-template-bar {
  align-items: end;
  border: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  padding: 8px;
}

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

.column-map {
  border: 1px solid var(--line);
  display: grid;
  gap: 7px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(70px, 1fr));
  margin: 0;
  padding: 8px;
}

.column-map[hidden] {
  display: none;
}

.column-map legend {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 0 4px;
  text-transform: uppercase;
}

.import-preview {
  background: var(--row-detail);
  border: 1px solid var(--line);
  color: var(--text);
  grid-column: 1 / -1;
  margin: 0;
  min-height: 82px;
  overflow: auto;
  padding: 8px;
  white-space: pre-wrap;
}

.icon-button {
  align-items: center;
  background: var(--tab-bg);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 700;
  height: 24px;
  justify-content: center;
  line-height: 1;
  min-width: 24px;
  padding: 0 5px;
}

.icon-button:hover {
  background: var(--panel-raised);
}

.delete-button {
  color: var(--danger);
}

.table-wrap {
  display: block;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  position: relative;
}

.table-wrap.is-loading-table {
  opacity: 0.72;
}

.table-wrap.is-loading-table::after {
  background: var(--tab-bg);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.attribute-workspace {
  --attribute-master-size: 60%;
  display: grid;
  flex: 1 1 auto;
  grid-template-rows: minmax(0, var(--attribute-master-size)) 8px minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.attribute-master-pane {
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.attribute-master-pane > .table-wrap {
  height: 100%;
  width: 100%;
}

.attribute-divider {
  background: color-mix(in srgb, var(--line-strong) 70%, var(--panel) 30%);
  border-bottom: 2px solid var(--panel);
  border-top: 2px solid var(--panel);
  cursor: row-resize;
  position: relative;
}

.attribute-divider::after {
  background: var(--muted);
  content: "";
  height: 2px;
  left: calc(50% - 24px);
  position: absolute;
  top: 1px;
  width: 48px;
}

.attribute-divider:focus {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.attribute-detail-pane {
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px;
}

.attribute-detail-empty {
  color: var(--muted-text);
  padding: 1rem;
  text-align: center;
}

.attribute-detail-status {
  color: var(--muted-text);
  padding: 1rem;
  text-align: center;
}

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

.attribute-card-grid {
  --attribute-card-column-count: 1;
  --attribute-card-min-width: 420px;
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(var(--attribute-card-column-count), minmax(0, 1fr));
}

.attribute-card-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.attribute-card {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  box-sizing: border-box;
  display: block;
  margin: 0;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 8px;
  width: 100%;
}

.attribute-card > .subitem-toolbar:first-child,
.attribute-card > .attribute-card-header:first-child {
  margin: -8px -8px 8px;
}

.attribute-card .subitem-toolbar {
  padding-left: 8px;
  padding-right: 8px;
}

.attribute-card-savebar {
  display: flex;
  justify-content: flex-end;
  margin: -4px -4px 6px;
}

.attribute-card-header {
  align-items: center;
  background: var(--tab-bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 32px;
  padding: 5px 8px;
}

.attribute-card-header h3 {
  font-size: 12px;
  margin: 0;
  text-transform: uppercase;
}

.attribute-card .nested-section,
.attribute-card.nested-section {
  margin-top: 0;
}

.type-power-card-body,
.type-network-profile-body {
  display: grid;
  gap: 0.75rem;
  padding: 0.75rem;
}

.attribute-card-subtitle {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0.15rem 0 0;
}

.type-power-builder-card {
  min-width: min(100%, 720px);
}

.power-builder-tabs {
  border-bottom: 1px solid var(--nested-rule);
  display: flex;
  gap: 0.25rem;
  padding: 0 0.75rem;
}

.power-builder-tabs button {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  padding: 0.65rem 0.8rem 0.5rem;
}

.power-builder-tabs button.is-active {
  border-bottom-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.power-builder-body {
  padding: 0.75rem;
}

.power-builder-body > section {
  display: grid;
  gap: 0.75rem;
}

.power-builder-well {
  background: color-mix(in srgb, var(--panel) 92%, var(--accent) 8%);
  border: 1px solid var(--nested-rule);
  border-radius: 8px;
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  padding: 0.75rem;
}

.power-builder-group {
  display: grid;
  gap: 0.5rem;
}

.power-builder-group-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.power-builder-group-header h4 {
  margin: 0;
}

.power-builder-wells {
  display: grid;
  gap: 0.5rem;
}

.power-builder-connector-well {
  position: relative;
}

.power-builder-field {
  display: grid;
  font-size: 0.82rem;
  gap: 0.25rem;
}

.power-builder-remove {
  align-self: end;
  justify-self: end;
}

.power-builder-help {
  color: var(--muted);
  margin: 0;
}

.power-builder-replace,
.power-builder-expert-toggle {
  align-items: center;
  display: flex;
  gap: 0.4rem;
}

.power-builder-replace {
  border-top: 1px solid var(--nested-rule);
  color: var(--danger);
  padding-top: 0.75rem;
}

.power-builder-review {
  overflow-x: auto;
}

.power-builder-review-table {
  width: 100%;
}

.power-builder-impact-list {
  margin: 0.65rem 0 0;
  padding-left: 1.25rem;
}

.power-builder-review-table caption {
  caption-side: top;
  font-weight: 700;
  padding: 0.4rem;
  text-align: left;
}

.power-builder-review-table td:first-child {
  font-weight: 700;
}

.type-power-card-body fieldset,
.type-network-profile-body fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 0.75rem;
  margin: 0;
  padding: 0.65rem;
  border: 1px solid var(--nested-rule);
}

.type-power-card-body legend,
.type-network-profile-body legend {
  padding: 0 0.35rem;
  font-weight: 700;
}

.type-power-field,
.type-network-field {
  display: grid;
  gap: 0.25rem;
}

.type-power-field.is-compact,
.type-network-field.is-compact {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.power-card-table-wrap,
.planning-card-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  padding: 8px;
}

.nested-table.power-configuration-table {
  border-collapse: collapse;
  display: table;
  table-layout: auto;
  width: max-content;
}

.nested-table.power-configuration-table thead {
  display: table-header-group;
}

.nested-table.power-configuration-table tbody {
  display: table-row-group;
}

.nested-table.power-configuration-table tr {
  display: table-row;
}

.nested-table.power-configuration-table th,
.nested-table.power-configuration-table td {
  display: table-cell;
}

.power-configuration-table th,
.power-configuration-table td {
  min-width: 92px;
  vertical-align: middle;
}

.power-configuration-table th:first-child,
.power-configuration-table td:first-child {
  min-width: 150px;
}

.power-configuration-table .actions-column {
  min-width: 38px;
}

.power-configuration-table tr.is-power-generated > td:first-child {
  border-left: 3px solid var(--accent);
}

.project-power-analysis {
  border-top: 1px solid var(--nested-rule);
  margin-top: 8px;
  overflow-x: auto;
  padding-top: 8px;
}

.project-power-analysis-summary {
  font-weight: 700;
  padding: 4px 8px 8px;
}

/* Analysis results are rendered straight into innerHTML rather than through
   renderTableHeader(), so they never receive the grid column widths that the
   .nested-table grid layout depends on. Without a template the grid collapses to one
   column and stacks every header and cell. Restore real table layout, as
   .power-configuration-table above does for the same reason. */
.nested-table.project-power-analysis-table {
  border-collapse: collapse;
  display: table;
  table-layout: auto;
  width: max-content;
}

.nested-table.project-power-analysis-table thead {
  display: table-header-group;
}

.nested-table.project-power-analysis-table tbody {
  display: table-row-group;
}

.nested-table.project-power-analysis-table tr {
  display: table-row;
}

.nested-table.project-power-analysis-table th,
.nested-table.project-power-analysis-table td {
  display: table-cell;
}

.project-power-analysis-table td,
.project-power-analysis-table th {
  vertical-align: middle;
  white-space: nowrap;
}

.project-power-diagnostics {
  display: grid;
  gap: 4px;
  padding: 8px;
}

.project-power-diagnostic {
  border-left: 3px solid var(--accent);
  padding: 4px 8px;
}

.project-power-diagnostic.is-error {
  border-left-color: var(--danger);
  font-weight: 700;
}

.attribute-card .subitems-panel-content,
.attribute-card.subitems-panel-content {
  display: block;
  min-width: 0;
}

.attribute-card .nested-table {
  max-width: 100%;
  min-width: 0;
}

.attribute-general-grid {
  display: grid;
  gap: 8px;
  grid-auto-flow: row dense;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.attribute-general-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  grid-column: span 6;
  min-width: 0;
}

.attribute-general-field.is-compact {
  align-items: center;
  align-self: end;
  flex-direction: row;
  gap: 7px;
  grid-column: span 3;
  min-height: 28px;
}

.attribute-general-field.is-wide {
  grid-column: 1 / -1;
}

.attribute-general-field.is-multiline .cell-textarea {
  min-height: 76px;
  resize: vertical;
}

.attribute-general-field > span:first-child {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.attribute-readonly-value {
  min-height: 28px;
  overflow-wrap: anywhere;
  padding: 6px 7px;
}

.master-field-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attribute-master-pane tr[data-row-catalog="types"],
.attribute-master-pane tr[data-row-catalog="elements"],
.attribute-master-pane tr[data-row-catalog="element-family-items"],
.attribute-master-pane tr[data-row-catalog="vendors"] {
  cursor: pointer;
}

.attribute-master-pane tr[data-row-catalog="types"] > td,
.attribute-master-pane tr[data-row-catalog="elements"] > td,
.attribute-master-pane tr[data-row-catalog="element-family-items"] > td,
.attribute-master-pane tr[data-row-catalog="vendors"] > td {
  align-items: center;
  display: flex;
}

.vendor-line-card-list {
  background: var(--input-bg);
  border: 1px solid var(--line-strong);
  max-height: 300px;
  min-height: 240px;
  overflow-y: auto;
  padding: 4px;
  width: 100%;
}

.vendor-line-card-list.is-dirty {
  border-color: var(--focus);
  box-shadow: inset 3px 0 var(--focus);
}

.vendor-line-card-choice {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 8px;
  min-height: 28px;
  padding: 3px 6px;
}

.vendor-line-card-choice:hover {
  background: var(--tab-bg);
}

.vendor-line-card-choice input {
  flex: none;
  margin: 0;
}

.vendor-line-card-empty {
  color: var(--muted);
  margin: 0;
  padding: 8px;
}

.attribute-master-pane tr.is-attribute-selected > td {
  box-shadow: inset 0 2px var(--accent), inset 0 -2px var(--accent);
}

.attribute-master-pane tr.is-attribute-selected > td:first-child {
  box-shadow: inset 2px 0 var(--accent), inset 0 2px var(--accent), inset 0 -2px var(--accent);
}

.attribute-master-pane tr.is-attribute-selected > td:last-child {
  box-shadow: inset -2px 0 var(--accent), inset 0 2px var(--accent), inset 0 -2px var(--accent);
}

@media (max-width: 680px) {
  .attribute-general-field {
    grid-column: 1 / -1;
  }

  .attribute-general-field.is-compact {
    grid-column: span 6;
  }
}

.data-table {
  display: grid;
  min-width: 0;
  width: auto;
}

.data-table thead,
.data-table tbody,
.data-table tr,
.nested-table thead,
.nested-table tbody,
.nested-table tr {
  display: contents;
}

.data-table tr[hidden],
.nested-table tr[hidden] {
  display: none;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  box-sizing: border-box;
  min-width: 0;
  padding: 3px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: var(--subtab-bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  height: 26px;
  position: sticky;
  top: 0;
  text-transform: uppercase;
  z-index: 20;
}

.data-table th,
.nested-table th {
  position: sticky;
}

.data-table .actions-column,
.nested-table .actions-column {
  background: var(--panel);
}

.data-table td.actions-column,
.nested-table td.actions-column {
  align-items: center;
  display: flex;
  gap: 4px;
  justify-content: flex-start;
  white-space: nowrap;
}

[data-table="inventory-demands"] > thead > tr > th,
[data-table="inventory-demands"] > tbody > tr:not([data-demand-type-detail]) > td,
.demand-detail-table th,
.demand-detail-table td {
  align-items: center;
  display: flex;
}

[data-table="inventory-demands"] > tbody > tr:not([data-demand-type-detail]) > td > .master-field-label,
.demand-detail-table td {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table.has-horizontal-overflow .actions-column,
.nested-table.has-horizontal-overflow .actions-column {
  box-shadow: -1px 0 0 var(--line);
  position: sticky;
  right: 0;
  z-index: 15;
}

.data-table th.actions-column,
.nested-table th.actions-column {
  background: var(--subtab-bg);
}

.data-table.has-horizontal-overflow th.actions-column,
.nested-table.has-horizontal-overflow th.actions-column {
  z-index: 35;
}

.data-table .expander-column,
.nested-table .expander-column {
  width: 34px;
}

.bulk-select-checkbox {
  accent-color: var(--accent);
  cursor: pointer;
  height: 16px;
  margin: 0 2px 0 0;
  width: 16px;
}

.bulk-select-checkbox:focus {
  outline: 1px solid var(--focus);
  outline-offset: 1px;
}

.cell-input,
.cell-select {
  background: var(--input-bg);
  border: 1px solid transparent;
  border-radius: 0;
  box-sizing: border-box;
  color: var(--text);
  color-scheme: light dark;
  font: inherit;
  min-height: 24px;
  min-width: 0;
  padding: 2px 4px;
  width: 100%;
}

.header-select option,
.cell-select option {
  background: var(--panel);
  color: var(--text);
}

.cell-input.is-dirty,
.cell-select.is-dirty {
  font-style: italic;
}

.cell-input:focus,
.cell-select:focus {
  border-color: var(--focus);
  outline: 1px solid var(--focus);
}

.cell-input.is-invalid,
.cell-select.is-invalid {
  border-color: var(--danger);
  outline: 1px solid var(--danger);
}

.cell-input.is-duplicate,
.cell-select.is-duplicate {
  background: var(--duplicate-bg);
}

.cell-input.is-not-applicable,
.cell-select.is-not-applicable {
  background: color-mix(in srgb, var(--input-bg) 55%, var(--line) 45%);
  color: var(--muted);
  font-style: italic;
}

.cell-input.is-not-applicable::placeholder,
.cell-select.is-not-applicable::placeholder {
  color: var(--muted);
  font-style: italic;
}

.empty-row {
  color: var(--muted);
  padding: 14px;
}

.data-table tbody tr.is-banded-row > td {
  background: var(--row-alt);
}

.nested-table tbody tr.is-banded-row > td {
  background: var(--row-alt-nested);
}

.data-table tbody tr.is-banded-row > td.actions-column {
  background: var(--row-alt);
}

.nested-table tbody tr.is-banded-row > td.actions-column {
  background: var(--row-alt-nested);
}

.data-table tbody tr.is-link-source-row > td {
  box-shadow: inset 4px 0 0 color-mix(in srgb, var(--accent) 72%, var(--panel) 28%);
}

.data-table tbody tr.is-linked-row > td {
  background: color-mix(in srgb, var(--accent) 10%, var(--panel) 90%);
}

.data-table tbody tr.is-linked-row > td.actions-column {
  background: color-mix(in srgb, var(--accent) 10%, var(--panel) 90%);
}

.data-table tbody tr.is-orphaned-linked-row > td,
.data-table tbody tr.is-orphaned-linked-row > td.actions-column {
  background: color-mix(in srgb, var(--danger) 12%, var(--panel) 88%);
}

.data-table tbody tr.is-selected-row > td {
  background: color-mix(in srgb, var(--accent) 14%, var(--panel) 86%);
}

.data-table tbody tr.is-selected-row > td.actions-column {
  background: color-mix(in srgb, var(--accent) 14%, var(--panel) 86%);
}

.data-table tbody tr.is-disabled-element-row > td,
.data-table tbody tr.is-disabled-element-row > td.actions-column {
  background: color-mix(in srgb, var(--panel) 72%, var(--line) 28%);
  color: var(--muted);
  font-style: italic;
}

.data-table tbody tr.is-disabled-element-row .cell-input,
.data-table tbody tr.is-disabled-element-row .cell-select,
.data-table tbody tr.is-disabled-element-row .subitems-panel,
.data-table tbody tr.is-disabled-element-row .nested-table {
  color: var(--muted);
  font-style: italic;
}

.data-table tbody tr.is-overloaded-row > td,
.nested-table tbody tr.is-overloaded-row > td {
  background: var(--overload-bg);
}

.data-table tbody tr.is-overloaded-row > td.actions-column,
.nested-table tbody tr.is-overloaded-row > td.actions-column {
  background: var(--overload-bg);
}

.data-table .cell-input,
.data-table .cell-select,
.nested-table .cell-input,
.nested-table .cell-select {
  background: transparent;
}

.family-row {
  background: var(--panel);
}

.category-row {
  background: var(--panel);
}

.type-row {
  background: var(--panel);
}

.vendor-row,
.project-row,
.location-row {
  background: var(--panel);
}

.type-details-row > td,
.type-prices-row > td,
.category-children-row > td,
.vendor-contacts-row > td,
.project-contacts-row > td,
.connector-circuits-row > td,
.family-items-row > td,
.family-member-children-row > td,
.element-members-row > td,
.location-children-row > td {
  background: var(--row-detail);
  grid-column: 1 / -1;
  padding: 0;
}

.subitems-panel {
  border-left: 4px solid var(--nested-rule);
  margin-left: 34px;
  padding: 6px 6px 7px;
}

.subitems-panel-content {
  display: block;
  min-width: 100%;
}

.nested-section {
  margin-top: 10px;
}

.nested-section-heading {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.type-prices-panel-content {
  display: inline-flex;
  flex-direction: column;
  max-width: 100%;
  min-width: 0;
  width: max-content;
}

.type-configuration-panel {
  min-width: min(100%, 760px);
}

.type-configuration-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.type-configuration-group {
  background: var(--panel);
  border: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding: 10px;
}

.type-configuration-group-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.type-configuration-fields {
  display: grid;
  gap: 10px;
}

.type-configuration-group.is-dimensions-power {
  grid-column: 1 / -1;
}

.type-configuration-group.is-dimensions-power .type-configuration-fields {
  gap: 6px;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
}

.type-configuration-group.is-dimensions-power .type-configuration-field {
  gap: 2px;
}

.type-configuration-group.is-dimensions-power .type-configuration-field > span {
  font-size: 9px;
}

.type-configuration-field {
  color: var(--muted);
  display: grid;
  gap: 4px;
}

.type-configuration-field > span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.type-configuration-field > .cell-input,
.type-configuration-field > .cell-select,
.type-configuration-field > .cell-checkbox {
  min-width: 0;
  width: 100%;
}

.type-configuration-field > .cell-checkbox {
  justify-self: start;
  width: auto;
}

.speaker-assignment-panel {
  min-width: min(100%, 560px);
}

.speaker-assignment-fields {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.speaker-assignment-field {
  color: var(--muted);
  display: grid;
  gap: 4px;
}

.speaker-assignment-field > span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.speaker-assignment-field > .cell-input,
.speaker-assignment-field > .cell-select {
  min-width: 0;
  width: 100%;
}

.project-usage-panel {
  margin-bottom: 8px;
}

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

.project-usage-entry {
  background: var(--panel);
  border: 1px solid var(--line);
  display: grid;
  gap: 6px;
  padding: 8px 10px;
}

.project-usage-project {
  color: var(--text);
  font-weight: 700;
}

.project-usage-locations {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-usage-location {
  background: var(--row-alt);
  border: 1px solid var(--line);
  color: var(--text);
  display: inline-flex;
  font-size: 12px;
  padding: 3px 8px;
}

.project-usage-empty {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.subitem-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  margin-bottom: 4px;
  width: 100%;
}

.subitem-toolbar-field {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  flex: 1 1 280px;
  gap: 6px;
  margin-right: auto;
  min-width: 0;
}

.subitem-toolbar-field span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.subitem-toolbar-actions {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
  margin-left: auto;
}

.type-price-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  width: 100%;
}

.type-price-toolbar .subitem-toolbar-actions {
  flex: 0 0 auto;
  margin-left: auto;
}

.type-price-source-group {
  align-items: center;
  display: inline-flex;
  flex: 1 1 auto;
  gap: 6px;
  min-width: 0;
}

.type-price-source-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  text-transform: uppercase;
}

.element-link-panel {
  background: var(--row-detail);
  border: 1px solid var(--line);
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
  padding: 8px 10px;
}

.element-link-panel-body {
  display: grid;
  gap: 4px;
}

.subitem-source-select {
  max-width: 100%;
  min-width: 220px;
  width: min(320px, 100%);
}

.type-price-choice-table input[type="radio"] {
  margin: 0;
}

.nested-table {
  display: grid;
  min-width: 100%;
  width: max-content;
}

.nested-table th,
.nested-table td {
  border: 1px solid var(--line);
  box-sizing: border-box;
  min-width: 0;
  padding: 3px;
}

.nested-table th {
  background: var(--subtab-bg);
  color: var(--muted);
  font-size: 11px;
  position: sticky;
  top: 0;
  text-transform: uppercase;
  z-index: 10;
}

.header-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-cell-content {
  align-items: center;
  display: flex;
  gap: 4px;
  min-width: 0;
  padding-right: 10px;
}

.header-sort-button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  flex: none;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  height: 18px;
  line-height: 1;
  min-width: 18px;
  padding: 0;
}

.header-sort-button:hover,
.header-sort-button:focus-visible {
  border-color: var(--line-strong);
  color: var(--text);
  outline: none;
}

.header-sort-button.is-active {
  border-color: var(--line-strong);
  color: var(--text);
}

.header-sort-button[data-sort-level]::after {
  color: var(--muted);
  content: attr(data-sort-level);
  font-size: 9px;
  margin-left: 1px;
  vertical-align: top;
}

.header-sort-button.is-active[data-sort-level]::after {
  color: var(--text);
}

.header-label,
.header-cell-content {
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resizable-column {
  position: sticky;
}

.column-resize-handle {
  bottom: 0;
  cursor: col-resize;
  position: absolute;
  right: -3px;
  top: 0;
  width: 7px;
  z-index: 30;
}

.column-resize-handle:hover,
body.is-resizing-column .column-resize-handle {
  background: color-mix(in srgb, var(--focus) 45%, transparent);
}

body.is-resizing-column {
  cursor: col-resize;
  user-select: none;
}

.empty-row {
  grid-column: 1 / -1;
}

.expand-button {
  width: 24px;
}

.banner-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: min(420px, calc(100vw - 24px));
  position: fixed;
  right: 12px;
  top: 48px;
  z-index: 300;
}

.app-chrome {
  display: contents;
}

.working-lock {
  background: color-mix(in srgb, var(--overlay) 42%, transparent);
  bottom: 0;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 305;
}

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

.working-indicator {
  align-items: center;
  background: var(--header-bg);
  border: 1px solid var(--line-strong);
  box-shadow: 0 14px 34px rgb(0 0 0 / 28%);
  color: var(--header-text);
  display: inline-flex;
  font-size: 18px;
  font-weight: 700;
  gap: 14px;
  left: 50%;
  letter-spacing: 0.02em;
  min-height: 72px;
  min-width: 220px;
  justify-content: center;
  padding: 16px 24px;
  pointer-events: none;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 310;
}

.working-indicator[hidden] {
  display: none;
}

.working-indicator::before {
  animation: working-spin 0.85s linear infinite;
  border: 2px solid rgb(255 255 255 / 28%);
  border-top-color: var(--header-text);
  border-radius: 50%;
  content: "";
  display: inline-block;
  height: 22px;
  width: 22px;
}

@keyframes working-spin {
  to {
    transform: rotate(360deg);
  }
}

.banner-message {
  background: var(--banner-bg);
  border: 1px solid var(--line-strong);
  color: var(--banner-text);
  padding: 8px 10px;
  transition: opacity 240ms ease, transform 240ms ease;
  white-space: pre-line;
}

.banner-message.is-error {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.banner-message.is-exiting {
  opacity: 0;
  transform: translateY(-6px);
}

.modal-backdrop {
  align-items: center;
  background: var(--overlay);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  padding: 18px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 200;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-backdrop[data-confirm-backdrop] {
  z-index: 220;
}

.modal-window {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  color: var(--text);
  display: flex;
  flex-direction: column;
  max-height: min(680px, calc(100vh - 36px));
  max-width: min(680px, calc(100vw - 36px));
  width: 560px;
}

.modal-window.element-create-window {
  max-width: min(980px, calc(100vw - 36px));
  width: 920px;
}

.confirm-window {
  width: 420px;
}

.power-route-window {
  width: 620px;
}

.power-route-body {
  display: grid;
  gap: 12px;
  overflow-y: auto;
  padding: 12px;
}

.power-route-via-picker {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.power-route-stage-list {
  display: grid;
  gap: 6px;
  margin: 0;
  min-height: 24px;
  padding-left: 28px;
}

.power-route-stage-list li {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.power-connection-control {
  align-items: center;
  display: flex;
  gap: 4px;
}

.power-connection-control .cell-select {
  min-width: 150px;
}

.sort-window {
  width: 520px;
}

.filter-window {
  width: 760px;
}

.clone-window {
  width: 420px;
}

.export-window {
  display: flex;
  flex-direction: column;
  height: min(760px, calc(100vh - 36px));
  max-height: min(760px, calc(100vh - 36px));
  width: 760px;
}

.specification-viewer-window {
  height: min(860px, calc(100vh - 36px));
  max-height: min(860px, calc(100vh - 36px));
  max-width: min(1040px, calc(100vw - 36px));
  width: 1040px;
}

.modal-header {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
}

.specification-viewer-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.specification-viewer-title-group {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 0;
}

.specification-viewer-title-group h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.specification-viewer-toolbar {
  display: flex;
  gap: 6px;
}

.specification-viewer-badge,
.specification-file-badge {
  align-items: center;
  background: var(--tab-bg);
  border: 1px solid var(--line);
  color: var(--muted);
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  justify-content: center;
  min-height: 22px;
  min-width: 44px;
  padding: 0 8px;
  text-transform: uppercase;
}

.export-modal-body {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

.export-options {
  display: grid;
  gap: 8px;
}

.export-option-row[hidden] {
  display: none;
}

.export-option-field {
  display: grid;
  gap: 4px;
}

.clone-location-select {
  min-height: 132px;
  overflow-anchor: none;
  padding: 4px;
}

.modal-field-hint {
  color: var(--muted);
  font-size: 11px;
}

.export-column-picker {
  border: 1px solid var(--line);
  display: grid;
  gap: 4px;
  padding: 6px;
}

.export-column-picker-header {
  align-items: center;
  display: flex;
  font-weight: 700;
  gap: 8px;
  justify-content: space-between;
}

.export-column-list {
  display: grid;
  gap: 2px;
  list-style: none;
  margin: 0;
  max-height: 208px;
  overflow-y: auto;
  padding: 0;
}

.export-column-row {
  align-items: center;
  border: 1px solid transparent;
  display: grid;
  gap: 6px;
  grid-template-columns: auto auto 1fr auto auto;
  padding: 1px 2px;
}

.export-column-row.is-dragging {
  opacity: 0.4;
}

.export-column-row.is-drop-target {
  border-color: var(--accent);
}

.export-column-grip {
  color: var(--muted);
  cursor: grab;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1;
  padding: 0 2px;
  user-select: none;
}

.export-column-row.is-dragging .export-column-grip {
  cursor: grabbing;
}

.export-column-row.is-excluded .export-column-label {
  color: var(--muted);
}

.export-column-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-column-move {
  min-width: 22px;
  padding: 0 4px;
}

.export-option-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.export-report-type {
  display: grid;
  gap: 4px;
}

.export-report-type span,
.export-filter-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

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

.export-filter-group {
  display: grid;
  gap: 4px;
}

.export-filter-tools {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.export-filter-action {
  min-height: 24px;
  padding: 2px 8px;
}

.export-filter-select {
  min-height: 132px;
  overflow-anchor: none;
  padding: 4px;
}

.export-filter-select:disabled {
  opacity: 0.6;
}

.export-filter-select option {
  background: var(--input-bg);
  color: var(--text);
}

.export-filter-select option:checked {
  background: var(--accent);
  color: #ffffff;
}

.modal-header h2 {
  font-size: 15px;
  margin: 0;
}

.modal-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  max-height: calc(100vh - 100px);
  min-height: 0;
}

.export-window .modal-form {
  max-height: none;
}

.modal-fields {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: auto;
  padding: 10px;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.modal-field label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.modal-field.is-wide {
  grid-column: 1 / -1;
}

.element-target-picker {
  border-bottom: 1px solid var(--line);
  gap: 8px;
  padding-bottom: 12px;
}

.element-target-kind-field,
.element-target-list {
  display: grid;
  gap: 4px;
}

.element-target-kind-field {
  grid-template-columns: minmax(90px, 0.35fr) minmax(180px, 1fr);
  max-width: 420px;
}

.element-target-kind-field > span,
.element-target-list > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.element-target-kind-field > span {
  align-self: center;
}

.element-target-lists {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.element-target-lists.is-family {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.element-target-list select {
  min-height: 190px;
  overflow: auto;
}

.element-target-picker:has(.element-target-value.is-invalid) {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

.confirm-body {
  color: var(--text);
  padding: 12px 14px;
}

.confirm-body p {
  margin: 0;
}

.modal-actions {
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  padding: 8px 10px;
}

.table-load-error,
.element-list-continuation {
  text-align: center;
}

.table-load-error > span {
  color: var(--danger, #a33);
  margin-right: 0.75rem;
}

.sort-modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 10px;
}

.filter-modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 10px;
}

.specification-viewer-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.specification-viewer-nav {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 8px 10px;
}

.specification-viewer-page {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  min-width: 120px;
  text-align: center;
}

.specification-viewer-stage {
  align-items: center;
  background: var(--row-detail);
  display: flex;
  flex: 1;
  justify-content: center;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.specification-viewer-image {
  background: #ffffff;
  box-shadow: 0 10px 28px rgb(0 0 0 / 14%);
  height: auto;
  max-height: 100%;
  max-width: 100%;
}

.specification-viewer-frame {
  background: #ffffff;
  border: 1px solid var(--line);
  flex: 1;
  height: 100%;
  min-height: 0;
  width: 100%;
}

.specification-viewer-empty {
  color: var(--muted);
  font-size: 13px;
  max-width: 480px;
  text-align: center;
}

.label-preview-window {
  height: min(720px, calc(100vh - 36px));
  max-height: min(720px, calc(100vh - 36px));
  max-width: min(940px, calc(100vw - 36px));
  width: 940px;
}

.label-preview-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.label-preview-title-group {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 0;
}

.label-preview-title-group h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.label-preview-toolbar {
  display: flex;
  gap: 6px;
}

.label-preview-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.label-preview-summary,
.label-preview-notice {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  margin: 0;
  padding: 8px 10px;
}

.label-preview-notice {
  color: var(--danger);
  font-weight: 700;
}

.label-preview-stage {
  background: var(--row-detail);
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.label-preview-sheet {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.label-preview-sheet-caption {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

/* The stock is white whatever the shell's theme is, so the sheet carries its own ground rather
   than borrowing one that would misrepresent what gets printed. */
.label-preview-image {
  background: #ffffff;
  box-shadow: 0 8px 22px rgb(0 0 0 / 16%);
  height: auto;
  max-width: 100%;
  width: 100%;
}

.label-preview-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.specification-field {
  align-items: center;
  display: flex;
  min-width: 0;
  width: 100%;
}

.specification-link-bar {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  min-height: 22px;
  min-width: 0;
  width: 100%;
}

.specification-link {
  background: transparent;
  border: none;
  color: var(--focus);
  cursor: pointer;
  flex: 1 1 auto;
  font: inherit;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.specification-link:hover {
  color: var(--accent);
}

.specification-download-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  min-height: 22px;
  white-space: nowrap;
  padding: 0 7px;
}

.specification-url-input {
  min-width: 0;
  white-space: nowrap;
  width: 100%;
}

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

.type-rack-artwork-fields {
  display: grid;
  gap: 8px;
}

.type-rack-artwork-status {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.type-rack-artwork-label {
  color: var(--text);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

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

.clone-modal-body {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.filter-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-field-group.is-tall-filter-field {
  grid-row: span 2;
}

.filter-field-group span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.filter-select {
  min-height: 132px;
  overflow-anchor: none;
  padding: 4px;
}

.cell-listbox {
  min-height: 248px;
  overflow-anchor: none;
  padding: 4px;
}

.filter-field-group.is-tall-filter-field .filter-select {
  min-height: 274px;
}

.filter-select option {
  background: var(--input-bg);
  color: var(--text);
}

.filter-select option:checked {
  background: var(--accent);
  color: #ffffff;
}

.sort-levels {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sort-level-row {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: 68px minmax(0, 1fr) 140px;
}

.sort-level-row.has-group-options {
  grid-template-columns: 68px minmax(0, 1fr) 140px 78px 78px;
}

.sort-level-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  min-height: 24px;
  padding-top: 6px;
  text-transform: uppercase;
}

.sort-level-row label {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sort-level-toggle {
  align-items: center;
}

.sort-level-toggle input {
  margin: 0;
}

.sort-level-row span,
.sort-default-option span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.sort-default-option {
  align-items: center;
  display: flex;
  gap: 8px;
}

.company-profile-form {
  align-content: start;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.company-profile-form label {
  display: grid;
  gap: 4px;
}

.company-profile-form label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.company-profile-form .is-wide {
  grid-column: 1 / -1;
}

.project-settings-form {
  align-content: start;
}

.project-settings-form .is-wide {
  grid-column: 1 / -1;
}

.text-button {
  background: var(--tab-bg);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  min-height: 28px;
  padding: 4px 12px;
}

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

.text-button.filter-active,
.text-button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.text-button.has-unsaved-changes:not(:disabled) {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.text-button:disabled {
  background: color-mix(in srgb, var(--tab-bg) 70%, var(--line) 30%);
  color: var(--muted);
  cursor: default;
  opacity: 0.7;
}

.auth-status {
  align-items: center;
  display: flex;
  gap: 10px;
}

.auth-body-text,
.settings-help {
  color: var(--muted);
  margin: 0;
}

.label-preview-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 4px;
}

.label-preview-stock,
.label-preview-copies {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Two controls sharing a row squeeze each other's captions onto a second line otherwise. */
.label-preview-stock > span,
.label-preview-copies > span {
  white-space: nowrap;
}

.label-preview-stock select {
  max-width: 22rem;
}

.label-preview-copies input {
  width: 5rem;
}

.settings-help.is-error {
  color: var(--danger, #b3261e);
}

.auth-window {
  border-color: var(--line-strong);
  box-shadow: 0 22px 48px rgb(0 0 0 / 18%);
  max-width: 420px;
  position: relative;
  width: min(420px, calc(100vw - 32px));
}

.rack-print-window {
  max-width: 480px;
  width: min(480px, calc(100vw - 32px));
}

.network-print-window {
  max-width: 640px;
  width: min(640px, calc(100vw - 32px));
}

.network-print-section-fieldset {
  border: 1px solid var(--line);
  margin: 0;
  padding: 10px;
}

.network-print-section-fieldset legend {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 0 5px;
  text-transform: uppercase;
}

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

.network-print-section-grid label {
  align-items: center;
  display: flex;
  gap: 7px;
}

@media (max-width: 560px) {
  .network-print-section-grid {
    grid-template-columns: 1fr;
  }
}

.rack-print-form {
  gap: 14px;
}

.auth-form {
  gap: 16px;
  padding: 22px 24px 20px;
}

.auth-form .modal-field {
  gap: 6px;
}

.auth-form .modal-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.auth-form .modal-actions {
  border-top: none;
  padding: 4px 0 0;
}

.auth-build-label {
  bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  left: 10px;
  margin: 0;
  position: absolute;
}

.about-build-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 10px;
}

.about-build-list div {
  border: 1px solid var(--line);
  padding: 8px;
}

.about-build-list dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.about-build-list dd {
  font-size: 14px;
  margin: 3px 0 0;
}

.about-build-help {
  padding: 0 10px 10px;
}

[data-auth-backdrop],
.oauth-auth-backdrop {
  background: var(--bg);
}

.oauth-auth-user {
  background: var(--row-alt);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 10px;
}

.oauth-auth-error {
  background: color-mix(in srgb, var(--danger) 14%, var(--panel) 86%);
  border: 1px solid color-mix(in srgb, var(--danger) 42%, var(--line) 58%);
  color: var(--danger);
  margin: 0;
  padding: 8px 10px;
}

.cell-checkbox {
  accent-color: var(--accent);
  height: 16px;
  width: 16px;
}

.review-field {
  display: block;
  margin: 0 auto;
}

.review-field.cell-checkbox {
  appearance: none;
  background: transparent;
  border: none;
  box-shadow: none;
  cursor: pointer;
  display: grid;
  height: 18px;
  margin: 0 auto;
  place-items: center;
  width: 18px;
}

.review-field.cell-checkbox::before {
  color: transparent;
  content: "?";
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.review-field.cell-checkbox:checked::before {
  color: #c39500;
}

.review-field.cell-checkbox:focus-visible {
  outline: 1px solid var(--line-strong);
  outline-offset: 1px;
}

.auth-provider-toggle {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.auth-provider-toggle.is-disabled {
  opacity: 0.8;
}

.database-settings-form,
.database-restore-form {
  display: grid;
  gap: 12px;
}

.database-settings-form {
  align-content: start;
  grid-template-columns: minmax(0, 1fr);
}

.database-settings-form .settings-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.database-settings-grid {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.database-settings-grid .is-wide {
  grid-column: 1 / -1;
}

.database-settings-columns {
  align-items: start;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr);
}

.database-settings-drive-panel,
.database-settings-restore-panel {
  align-content: start;
  border: 1px solid var(--line);
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 10px;
}

.database-settings-drive-panel .settings-actions,
.database-settings-restore-panel .settings-actions {
  justify-content: flex-start;
}

.database-settings-restore-panel {
  grid-template-columns: minmax(0, 1fr);
}

[data-database-google-backup-list] {
  min-height: 300px;
}

.fail2ban-settings-card {
  grid-column: 1 / -1;
}

.fail2ban-settings-form {
  align-items: start;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(260px, 1.1fr) minmax(280px, 1fr);
}

.fail2ban-settings-panel {
  align-content: start;
  border: 1px solid var(--line);
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 10px;
}

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

.fail2ban-settings-grid .is-wide {
  grid-column: 1 / -1;
}

.fail2ban-toggle-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.fail2ban-whitelist-input {
  min-height: 124px;
  resize: vertical;
}

@media (max-width: 720px) {
  .app-shell {
    padding: 6px;
  }

  .tab-button {
    flex: 1 1 auto;
  }

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

  .element-target-lists,
  .element-target-lists.is-family {
    grid-template-columns: 1fr;
  }

  .element-target-kind-field {
    grid-template-columns: 1fr;
    max-width: none;
  }

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

  .type-rack-artwork-grid {
    grid-template-columns: 1fr;
  }

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

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

  .database-settings-grid,
  .database-settings-columns,
  .fail2ban-settings-form,
  .fail2ban-settings-grid {
    grid-template-columns: 1fr;
  }
}

.racks-workspace {
  min-height: 0;
}

.racks-workspace.is-loading-racks {
  opacity: 0.72;
}

.racks-empty-message {
  margin: 1rem 0;
  color: var(--muted-text);
}

.racks-shell {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 0;
}

.racks-subtab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.racks-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.racks-summary-chip {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 8rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  background: var(--panel);
}

.racks-summary-label {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-text);
}

.racks-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 25%) minmax(0, 1fr);
  gap: 0.9rem;
  min-height: 0;
}

.racks-palette-panel,
.racks-stage-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0.8rem;
  border: 1px solid var(--line);
  background: var(--panel);
}

.racks-panel-header {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.racks-panel-heading {
  align-items: center;
  display: flex;
  flex: 1 1 auto;
  gap: 0.45rem;
  min-width: 0;
}

.racks-panel-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 0.4rem;
}

.racks-panel-header h3 {
  margin: 0;
}

.rack-help-button {
  align-items: center;
  background: var(--subtab-bg);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: help;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 700;
  height: 1.2rem;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 1.2rem;
}

.rack-help-button:focus {
  outline: 1px solid var(--focus);
  outline-offset: 1px;
}

.racks-palette-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  min-height: 0;
  padding: 0.25rem;
  overflow: auto;
}

.racks-palette-panel {
  max-height: min(100%, calc(100vh - 15rem));
  overflow: hidden;
}

.rack-tab-button {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  gap: 0.14rem;
  justify-content: center;
  min-height: 46px;
  min-width: 11rem;
  padding: 5px 10px;
  text-align: left;
}

.rack-tab-button-primary,
.rack-tab-button-secondary {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rack-tab-button-primary {
  font-size: 0.74rem;
  font-weight: 700;
}

.rack-tab-button-secondary {
  color: var(--muted-text);
  font-size: 0.67rem;
}

.rack-palette-item,
.rack-placement-block {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  padding: 0.12rem 0.45rem;
  border: 1px solid #181b1f;
  background: #3a3d42;
  box-sizing: border-box;
  color: #ffffff;
}

.rack-palette-item {
  cursor: grab;
}

.rack-palette-item.is-placed {
  opacity: 0.3;
  cursor: default;
  filter: grayscale(0.18);
}

.rack-tab-button.is-disabled-rack .rack-tab-button-primary,
.rack-tab-button.is-disabled-rack .rack-tab-button-secondary {
  font-style: italic;
}

.rack-palette-item.is-disabled-equipment,
.rack-placement-block.is-disabled-equipment {
  background: #777c84;
  color: #f4f5f6;
  font-style: italic;
  filter: grayscale(1);
}

.rack-palette-item.is-disabled-unassigned {
  border-color: #555b63;
  opacity: 0.72;
}

.rack-palette-item.is-placed.is-disabled-used {
  background: #a4a8ad;
  border-color: #777c82;
  color: #e8e9eb;
  opacity: 0.28;
}

.rack-placement-block.is-disabled-mounted {
  background: #747980;
  border-color: #4f545a;
  opacity: 0.62;
}

.rack-side-block.is-disabled-equipment {
  filter: grayscale(1);
  opacity: 0.38;
}

.racks-equipment-table tbody tr.is-disabled-equipment-row td {
  background: color-mix(in srgb, var(--panel) 72%, var(--line) 28%);
  color: var(--muted);
  font-style: italic;
}

.rack-palette-badge,
.rack-placement-badge {
  position: absolute;
  top: 0.16rem;
  right: 0.28rem;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.rack-power-alert {
  align-items: center;
  background: #f2c94c;
  border: 1px solid #7a5a00;
  color: #1f1a0a;
  cursor: help;
  display: inline-flex;
  font-size: 0.58rem;
  font-weight: 800;
  height: 0.9rem;
  justify-content: center;
  left: 0.28rem;
  line-height: 1;
  min-width: 0.9rem;
  pointer-events: auto;
  position: absolute;
  top: 0.16rem;
  z-index: 5;
}

.rack-power-alert::after {
  background: #1f2937;
  border: 1px solid #0f172a;
  color: #ffffff;
  content: attr(data-tooltip);
  display: none;
  font-size: 0.68rem;
  font-weight: 600;
  left: 1.15rem;
  line-height: 1.25;
  max-width: 15rem;
  padding: 0.35rem 0.45rem;
  position: absolute;
  text-align: left;
  top: -0.18rem;
  transform: translateY(-100%);
  white-space: normal;
  z-index: 12;
}

.rack-power-alert:hover::after,
.rack-power-alert:focus-visible::after {
  display: block;
}

.rack-palette-item.has-power-alert,
.rack-placement-block.has-power-alert {
  overflow: visible;
}

.rack-item-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.04rem;
  width: 100%;
  text-align: center;
  font-size: 0.64rem;
  font-weight: 600;
  line-height: 1.05;
}

.rack-palette-meta {
  position: absolute;
  left: 0.28rem;
  bottom: 0.12rem;
  font-size: 0.58rem;
  color: rgba(255, 255, 255, 0.82);
}

.racks-views-viewport {
  min-height: 0;
  overflow: auto;
  padding-bottom: 0.2rem;
}

.racks-views-grid {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) minmax(12rem, 1.1fr) minmax(12rem, 1fr);
  gap: 0.85rem;
  align-items: start;
  min-width: 48rem;
}

.racks-equipment-panel {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.95rem;
  min-height: 0;
}

.racks-equipment-empty {
  margin: 0;
  color: var(--muted-text);
}

.racks-equipment-table-wrap {
  max-width: 100%;
  max-height: min(18rem, 38vh);
  overflow-x: auto;
  overflow-y: auto;
}

.racks-equipment-table {
  display: table;
  table-layout: fixed;
  width: 100%;
}

.racks-equipment-table thead {
  display: table-header-group;
}

.racks-equipment-table tbody {
  display: table-row-group;
}

.racks-equipment-table tr {
  display: table-row;
}

.racks-equipment-table th,
.racks-equipment-table td {
  display: table-cell;
}

.racks-equipment-table td {
  background: var(--panel);
}

.racks-equipment-table th:first-child,
.racks-equipment-table td:first-child {
  width: 5.5rem;
}

.racks-equipment-table th:nth-child(2),
.racks-equipment-table td:nth-child(2) {
  width: 6.25rem;
}

.racks-equipment-table tr.is-warning td {
  background: rgba(242, 201, 76, 0.12);
}

.rack-view-panel {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.rack-view-panel header h3 {
  margin: 0;
}

.rack-view-actions {
  display: flex;
  justify-content: flex-start;
}

.rack-view-face,
.rack-view-side {
  min-height: 12rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  background: var(--panel);
}

.rack-face-unavailable {
  margin: 0;
  color: var(--muted-text);
}

.rack-face-canvas {
  position: relative;
  min-width: calc(var(--rack-label-width, 2rem) + var(--rack-row-gap, 0.35rem) + var(--rack-unit-width, 16rem));
}

.rack-side-canvas {
  position: relative;
  min-width: calc(var(--rack-label-width, 2rem) + var(--rack-row-gap, 0.35rem) + var(--rack-unit-width, 16rem));
}

.rack-ru-row,
.rack-side-row {
  display: grid;
  grid-template-columns: var(--rack-label-width, 2rem) var(--rack-unit-width, 16rem);
  gap: var(--rack-row-gap, 0.35rem);
  align-items: center;
  height: 39px;
}

.rack-ru-label {
  font-size: 0.75rem;
  text-align: right;
  color: var(--muted-text);
}

.rack-ru-slot,
.rack-side-cavity {
  position: relative;
  height: 100%;
  border-left: 2px solid rgba(30, 41, 59, 0.38);
  border-right: 2px solid rgba(30, 41, 59, 0.38);
  border-top: 1px solid rgba(30, 41, 59, 0.12);
  border-bottom: 1px solid rgba(30, 41, 59, 0.12);
  background: #eef1f4;
}

.rack-placement-block {
  position: absolute;
  left: calc(var(--rack-label-width, 2rem) + var(--rack-row-gap, 0.35rem));
  width: var(--rack-unit-width, 16rem);
  cursor: grab;
  border: 1px solid #181b1f;
  background: #3a3d42;
  z-index: 2;
}

.rack-placement-block.is-rear {
  background: #474038;
}

.rack-side-row {
  position: relative;
  z-index: 1;
}

.rack-side-cavity {
  overflow: hidden;
}

.rack-side-block {
  position: absolute;
  top: 3px;
  z-index: 2;
}

.rack-side-block.is-front {
  background: rgba(54, 101, 145, 0.55);
}

.rack-side-block.is-rear {
  background: rgba(161, 107, 33, 0.58);
}

.rack-side-row.is-clash .rack-side-cavity {
  background: rgba(185, 28, 28, 0.12);
  box-shadow: inset 0 0 0 1px rgba(185, 28, 28, 0.22);
}

.rack-side-unknown {
  position: absolute;
  top: 3px;
  right: 0;
  bottom: 3px;
  left: 0;
  background-image: repeating-linear-gradient(135deg, rgba(55, 65, 81, 0.22) 0, rgba(55, 65, 81, 0.22) 6px, rgba(255, 255, 255, 0) 6px, rgba(255, 255, 255, 0) 12px);
  pointer-events: none;
  z-index: 1;
}

@media (max-width: 1080px) {
  .racks-layout {
    grid-template-columns: 1fr;
  }

  .racks-views-grid {
    min-width: 38rem;
  }
}

.networks-workspace,
.networks-shell,
.networks-layout,
.networks-view-viewport,
.networks-diagnostics {
  min-height: 0;
  min-width: 0;
}

.networks-workspace {
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.networks-workspace.is-loading-networks {
  opacity: 0.72;
}

.networks-project-label,
.networks-empty-message {
  color: var(--muted-text);
}

.networks-project-label {
  font-size: 0.72rem;
  margin: 0.08rem 0 0;
}

.networks-empty-message {
  margin: 1rem;
}

.networks-shell {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.65rem;
  overflow: hidden;
  padding: 0.7rem;
}

.networks-summary {
  display: grid;
  flex: none;
  gap: 0.45rem;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
}

.networks-summary-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0.48rem 0.62rem;
}

.networks-summary-card strong {
  font-size: 1rem;
  line-height: 1.15;
}

.networks-summary-card span {
  color: var(--muted-text);
  font-size: 0.66rem;
  letter-spacing: 0.055em;
  margin-top: 0.18rem;
  text-transform: uppercase;
}

.networks-view-tabs {
  display: flex;
  flex: none;
  gap: 0.3rem;
  overflow-x: auto;
}

.networks-view-tab {
  background: var(--subtab-bg);
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  flex: 0 0 auto;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.4rem 0.72rem;
}

.networks-view-tab:hover,
.networks-view-tab.is-active {
  border-color: var(--line-strong);
}

.networks-view-tab.is-active {
  background: color-mix(in srgb, var(--accent) 12%, var(--panel) 88%);
  box-shadow: inset 0 -3px var(--accent);
}

.networks-layout {
  border: 1px solid var(--line);
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 23rem);
  overflow: hidden;
}

.networks-view-viewport {
  overflow: auto;
  padding: 0.75rem;
}

.networks-view {
  display: none;
  min-width: 42rem;
}

.networks-view.is-active {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.networks-section-heading {
  align-items: baseline;
  display: flex;
  gap: 0.65rem;
  justify-content: space-between;
  margin-top: 0.15rem;
}

.networks-section-heading h3,
.networks-diagnostics h3,
.networks-island-card h4 {
  margin: 0;
}

.networks-section-heading h3 {
  font-size: 0.86rem;
}

.networks-section-heading p {
  color: var(--muted-text);
  font-size: 0.7rem;
  margin: 0;
  text-align: right;
}

.networks-table-wrap {
  border: 1px solid var(--line);
  max-height: 19rem;
  overflow: auto;
}

.networks-table {
  border-collapse: collapse;
  font-size: 0.72rem;
  min-width: 100%;
  width: max-content;
}

.networks-table th,
.networks-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.38rem 0.48rem;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.networks-table th {
  background: var(--tab-bg);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  position: sticky;
  text-transform: uppercase;
  top: 0;
  z-index: 1;
}

.networks-table tbody tr:last-child td {
  border-bottom: 0;
}

.networks-table-empty,
.networks-empty-state {
  color: var(--muted-text);
  font-style: italic;
}

.networks-table-empty {
  padding: 0.75rem !important;
  text-align: center !important;
}

.networks-island-grid {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.networks-island-card {
  border: 1px solid var(--line);
  border-top: 3px solid var(--line-strong);
  padding: 0.55rem;
}

.networks-island-card h4 {
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.networks-node-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.42rem;
}

.networks-element-link {
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent 55%);
  text-underline-offset: 0.15em;
}

.networks-element-link:hover,
.networks-element-link:focus-visible {
  text-decoration-color: currentColor;
}

.networks-diagnostics {
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.networks-diagnostics > header {
  align-items: baseline;
  background: var(--tab-bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex: none;
  justify-content: space-between;
  padding: 0.62rem 0.7rem;
}

.networks-diagnostics h3 {
  font-size: 0.8rem;
}

.networks-diagnostics header span {
  color: var(--muted-text);
  font-size: 0.68rem;
}

.networks-diagnostic-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.45rem;
  overflow: auto;
  padding: 0.6rem;
}

.networks-diagnostic {
  border: 1px solid var(--line);
  border-left: 3px solid #a16207;
  padding: 0.5rem 0.58rem;
}

.networks-diagnostic.is-error {
  border-left-color: var(--danger);
}

.networks-diagnostic strong {
  display: block;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.networks-diagnostic p {
  font-size: 0.72rem;
  line-height: 1.35;
  margin: 0.25rem 0 0.4rem;
}

.networks-empty-state {
  font-size: 0.72rem;
  margin: 0;
  padding: 0.5rem;
}

@media (max-width: 1080px) {
  .networks-layout {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .networks-view-viewport {
    min-height: 24rem;
  }

  .networks-diagnostics {
    border-left: 0;
    border-top: 1px solid var(--line);
    max-height: 16rem;
    min-height: 10rem;
  }
}
.project-price-table input[type="text"],
.project-price-table input[type="number"],
.project-price-table input[type="url"] {
  min-width: 6rem;
  width: 100%;
}

.project-price-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
}

.project-price-table .project-price-actions {
  display: flex;
  gap: 0.25rem;
  white-space: nowrap;
}

/* Standalone browser documents share the UI palette without template-local CSS. */
.standalone-preview-page {
  background: #f5f6f7;
  color: #1c2430;
  font: 14px/1.5 Arial, Helvetica, sans-serif;
  margin: 0;
  padding: 24px;
}

.spec-docx-body {
  background: #fff;
  border: 1px solid #c9ced6;
  box-shadow: 0 10px 30px rgb(0 0 0 / 8%);
  margin: 0 auto;
  max-width: 8.5in;
  min-height: 11in;
  padding: 0.75in;
}

.spec-docx-body img,
.spec-print-page,
.art-preview img {
  height: auto;
  max-width: 100%;
}

.spec-docx-note {
  border-top: 1px solid #d6dce3;
  margin-top: 24px;
  padding-top: 16px;
}

.spec-print-stack {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.spec-print-page {
  background: #fff;
  box-shadow: 0 4px 20px rgb(0 0 0 / 10%);
  max-width: min(100%, 8.5in);
}

.art-preview {
  align-items: flex-start;
  display: flex;
  justify-content: center;
}

.art-preview img {
  background: #fff;
  border: 1px solid #c9ced6;
  box-shadow: 0 10px 28px rgb(0 0 0 / 10%);
  max-width: min(100%, 12in);
}

.pdf-generating-page {
  background: #f3efe7;
  color: #2f2417;
  display: grid;
  font: 600 16px/1.4 "Segoe UI", sans-serif;
  margin: 0;
  min-height: 100vh;
  place-items: center;
}

@media print {
  .standalone-preview-page {
    background: #fff;
    padding: 0;
  }

  .spec-docx-body,
  .spec-print-page,
  .art-preview img {
    border: none;
    box-shadow: none;
    max-width: 100%;
  }
}

.interface-shell-list {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.interface-shell-option {
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  display: grid;
  gap: 0.55rem;
  grid-template-columns: auto 1fr;
  padding: 0.55rem 0.7rem;
}

.interface-shell-option:hover {
  border-color: var(--accent);
}

.interface-shell-option input {
  margin-top: 0.2rem;
}

.interface-shell-option span {
  display: grid;
  gap: 0.15rem;
}

.interface-shell-option small {
  color: var(--muted);
}

/* ---------- Purchasing budget ---------- */

.budget-view {
  display: grid;
  gap: 0.9rem;
  padding: 0.5rem 0 1rem;
}

.budget-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.budget-total {
  border: 1px solid var(--line);
  border-right: 0;
  padding: 0.5rem 0.9rem;
}

.budget-total:last-child {
  border-right: 1px solid var(--line);
}

.budget-total b {
  display: block;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.budget-total span {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.budget-total.is-negative b { color: var(--danger); }
.budget-total.is-positive b { color: var(--accent); }

.budget-chart-wrap {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 0.75rem;
}

.budget-legend {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.78rem;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.budget-legend span {
  align-items: center;
  display: inline-flex;
  gap: 0.35rem;
}

.budget-swatch {
  border-radius: 2px;
  display: inline-block;
  height: 11px;
  width: 11px;
}

.budget-swatch-allotment { background: var(--accent); }
.budget-swatch-spend { background: #b7791f; }
.budget-swatch-line { background: var(--text); }

.budget-chart { overflow-x: auto; }
.budget-chart svg { display: block; }

.budget-empty {
  color: var(--muted);
  padding: 1.5rem;
  text-align: center;
}

.budget-warning {
  background: var(--row-alt);
  border-left: 3px solid var(--danger);
  color: var(--danger);
  margin: 0;
  padding: 0.5rem 0.7rem;
}

.budget-table-scroll { overflow-x: auto; }
.budget-table td.is-negative { color: var(--danger); font-weight: 600; }
.budget-table td.is-positive { color: var(--accent); font-weight: 600; }
.budget-table tr.is-current td { background: var(--row-alt); font-weight: 600; }
.budget-table td.n { font-variant-numeric: tabular-nums; text-align: right; }
.budget-help { margin: 0; }

.demand-budget-indicator {
  align-items: center;
  display: inline-flex;
  gap: 0.4rem;
  font-variant-numeric: tabular-nums;
}

.demand-budget-indicator.is-negative { color: var(--danger); }

.cell-input.cell-date {
  font-variant-numeric: tabular-nums;
  min-width: 8.5rem;
}

/* The budget table is a plain table on purpose. `.data-table` is a CSS grid whose
   column count is assigned per table in JavaScript, so borrowing it without that
   assignment collapses every cell into one column. */
.budget-table {
  border-collapse: collapse;
  width: 100%;
}

.budget-table th,
.budget-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.35rem 0.6rem;
  text-align: left;
  white-space: nowrap;
}

.budget-table th {
  background: var(--tab-bg);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  position: sticky;
  text-transform: uppercase;
  top: 0;
}

.budget-table th:not(:first-child),
.budget-table td.n {
  text-align: right;
}

.budget-table tbody tr:hover td {
  background: var(--row-alt);
}

/* Power workspace. Deliberately a self-contained block rather than shared selectors with
   the Networks workspace, so either view can be restyled without disturbing the other. */
.power-workspace,
.power-shell,
.power-layout,
.power-view-viewport,
.power-diagnostics {
  min-height: 0;
  min-width: 0;
}

.power-workspace {
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.power-workspace.is-loading-power {
  opacity: 0.72;
}

.power-project-label,
.power-empty-message {
  color: var(--muted-text);
}

.power-project-label {
  font-size: 0.72rem;
  margin: 0.08rem 0 0;
}

.power-empty-message {
  margin: 1rem;
}

.power-shell {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.65rem;
  overflow: hidden;
  padding: 0.7rem;
}

.power-summary {
  display: grid;
  flex: none;
  gap: 0.45rem;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
}

.power-summary-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  color: inherit;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0.48rem 0.62rem;
  text-align: left;
}

button.power-summary-card {
  cursor: pointer;
}

button.power-summary-card:hover,
button.power-summary-card:focus-visible {
  border-color: var(--accent);
}

.power-summary-card strong {
  font-size: 1rem;
  line-height: 1.15;
}

.power-summary-card span {
  color: var(--muted-text);
  font-size: 0.66rem;
  letter-spacing: 0.055em;
  margin-top: 0.18rem;
  text-transform: uppercase;
}

.power-view-tabs {
  display: flex;
  flex: none;
  gap: 0.3rem;
  overflow-x: auto;
}

.power-view-tab {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted-text);
  cursor: pointer;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.7rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.power-view-tab:hover,
.power-view-tab.is-active {
  border-color: var(--accent);
}

.power-view-tab.is-active {
  background: var(--panel);
  color: var(--text);
}

.power-layout {
  display: flex;
  flex: 1;
  gap: 0.65rem;
  overflow: hidden;
}

.power-view-viewport {
  flex: 1;
  overflow: auto;
}

.power-view {
  display: none;
}

.power-view.is-active {
  display: block;
}

.power-section-heading {
  margin: 0.9rem 0 0.4rem;
}

.power-section-heading:first-child {
  margin-top: 0;
}

.power-section-heading h3,
.power-diagnostics h3 {
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  margin: 0;
  text-transform: uppercase;
}

.power-section-heading p {
  color: var(--muted-text);
  font-size: 0.7rem;
  margin: 0.16rem 0 0;
}

.power-source-heading {
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  margin: 0.7rem 0 0.3rem;
  text-transform: uppercase;
}

.power-table-wrap {
  border: 1px solid var(--line);
  overflow-x: auto;
}

.power-table {
  border-collapse: collapse;
  min-width: 100%;
  width: max-content;
}

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

.power-table th {
  background: var(--panel);
  color: var(--muted-text);
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  position: sticky;
  text-transform: uppercase;
  top: 0;
}

.power-table tbody tr:last-child td {
  border-bottom: none;
}

.power-table-empty,
.power-empty-state {
  color: var(--muted-text);
  font-size: 0.72rem;
}

.power-table-empty {
  padding: 0.6rem 0.5rem;
  text-align: center;
}

.power-element-link,
.power-assign-button,
.power-bulk-button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
}

.power-assign-button,
.power-bulk-button {
  border-color: var(--line);
  padding: 0.16rem 0.55rem;
}

.power-element-link:hover,
.power-element-link:focus-visible,
.power-assign-button:hover,
.power-bulk-button:hover:not(:disabled) {
  text-decoration: underline;
}

.power-bulk-button:disabled {
  color: var(--muted-text);
  cursor: default;
}

.power-bulk-bar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.72rem;
  gap: 0.4rem;
  margin: 0.4rem 0;
}

.power-preview {
  border: 1px solid var(--accent);
  margin-bottom: 0.6rem;
  padding: 0.5rem;
}

.power-preview h4 {
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  margin: 0 0 0.4rem;
  text-transform: uppercase;
}

.power-preview-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.power-chain {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.22rem;
}

.power-chain-chip {
  border: 1px solid var(--line);
  font-size: 0.66rem;
  padding: 0.06rem 0.32rem;
  white-space: nowrap;
}

.power-chain-chip.is-utility {
  border-color: var(--accent);
}

.power-chain-arrow {
  color: var(--muted-text);
  font-size: 0.66rem;
}

.power-status {
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.power-status.is-no-source,
.power-status.is-upstream-unpowered,
.power-status.is-no-power-port,
.power-status.is-no-profile {
  color: var(--danger, #c0392b);
}

.power-utilization.is-warning {
  color: var(--warning, #b8860b);
}

.power-utilization.is-over {
  color: var(--danger, #c0392b);
}

.power-row-hint {
  color: var(--muted-text);
  font-size: 0.66rem;
}

.power-diagnostics {
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-left: 0.65rem;
  width: 15rem;
}

.power-diagnostics > header {
  align-items: baseline;
  display: flex;
  gap: 0.4rem;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.power-diagnostics header span {
  color: var(--muted-text);
  font-size: 0.7rem;
}

.power-diagnostic-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-y: auto;
}

.power-diagnostic {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  padding: 0.32rem 0.44rem;
}

.power-diagnostic.is-error {
  border-left-color: var(--danger, #c0392b);
}

.power-diagnostic strong {
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.power-diagnostic p {
  color: var(--muted-text);
  font-size: 0.7rem;
  margin: 0.16rem 0 0;
}

.type-shortcode-body {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 6px 0 2px;
}

/* The plate stays white in both themes. A QR is read by a camera rather than by a person, and
   scanners expect dark modules on a light field, so the symbol carries its own ground. */
.type-shortcode-qr {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 4px;
  flex: 0 0 auto;
  line-height: 0;
  padding: 6px;
}

.type-shortcode-qr img {
  display: block;
  height: 112px;
  width: 112px;
}

.type-shortcode-details {
  display: flex;
  flex: 1 1 220px;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.type-shortcode-value {
  align-items: center;
  display: flex;
  gap: 6px;
  min-width: 0;
}

.type-shortcode-link {
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.type-shortcode-note {
  color: var(--muted);
  font-size: 11px;
  margin: 0;
}
