:root {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--page-background);
  font-synthesis: none;
  --blue: #1769e0;
  --line: #d9dee8;
  --muted: #667085;
  /* Shared semantic UI roles; brand, status, illustration and print ink stay explicit where their meaning is fixed. */
  --text: #172033;
  --accent: #1769aa;
  --surface: #fff;
  --surface-soft: #f7f8fa;
  --panel: #fff;
  --panel-soft: #f8fafc;
  --text-strong: #172033;
  --line-icon: #cbd3df;
  --accent-border: #bfd4f5;
  --line-strong: #cbd3df;
  --line-subtle: #d9dee8;
  --surface-raised: #f8fafc;
  --surface-hover: #eff6ff;
  --panel-elevated: #fff;
  --accent-surface: #f0f6ff;
  --accent-text: #1769e0;
  --error-text: #b42318;
  --topbar-background: #101a2f;
  --topbar-input-background: #ffffff0c;
  --page-background: #eef1f6;
  --workspace-background: #e9edf3;
  --inventory-background: #f7f8fb;
  --control-background: #fff;
  --control-border: #d9dee8;
  --control-hover-background: #eff6ff;
  --control-hover-border: #1769e0;
  --field-background: #fff;
  --field-border: #cbd3df;
  --field-text: #172033;
  --field-focus-background: #f0f6ff;
  --field-focus-border: #1769e0;
  --field-focus-ring: #1769e033;
  --toolbar-background: #fff;
  --footer-background: #f8fafc;
  --toolbar-text: #465166;
  --toolset-text: #465166;
  --dialog-text: #000;
  --footer-text: #667085;
  --panel-border: #d9dee8;
  --topbar-input-text: #fff;
  --topbar-input-border: #ffffff30;
  --topbar-primary-background: #ff7a1a;
  --badge-background: #eaf1fc;
  --badge-text: #1769e0;
  --theme-button-text: #e2e8f0;
  --inventory-card-background: #f8fafc;
  --inventory-tile-background: #fff;
  --inventory-note-background: #f4f8ff;
  --inventory-note-border: #dbe7f7;
  --color-control-background: transparent;
  --context-heading-border: #d9dee8;
  --topbar-nav-background: #ffffff0c;
  --color-control-border: #d9dee8;
  --dialog-border: #d9dee8;
  --label-text: #465166;
  /* Smallest text size and the muted text colour that keeps 4.5:1 contrast on white
     (AUDIT A11Y-3: 9-10 px text and #748099 at 3.97:1). */
  --font-small: 11px;
  --muted-text: #5b667a;
  /* Stacking order, lowest first (AUDIT CSS-3). */
  --z-raised: 1;
  --z-canvas-tools: 5;
  --z-menu: 100;
  --z-dropdown: 120;
  --z-popover: 1000;
  --z-drag: 1200;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
  border: 1px solid var(--control-border);
  background: var(--control-background);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
}
button:hover {
  border-color: var(--control-hover-border);
  background: var(--control-hover-background);
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
button.primary {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
#canvas-wrap:focus-visible {
  outline: 2px solid #1769e0;
  outline-offset: 2px;
}
.topbar {
  height: 72px;
  background: var(--topbar-background);
  color: white;
  display: flex;
  align-items: center;
  gap: 25px;
  padding: 0 22px;
  box-shadow: 0 2px 12px #0f172a35;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #ff7a1a, #f04b24);
  font-size: 15px;
  font-weight: 900;
}
.brand h1 {
  font-size: 18px;
  letter-spacing: -0.4px;
  margin: 0 0 4px;
}
.brand small {
  font-size: var(--font-small);
  border: 1px solid #ffffff30;
  border-radius: 10px;
  padding: 2px 5px;
  color: #bac6d9;
}
.brand div > span {
  font-size: 11px;
  color: #9eabc1;
}
.topbar > input {
  min-width: 100px;
  max-width: 300px;
  flex: 1;
  margin-left: auto;
  text-align: center;
  background: var(--topbar-input-background);
  color: var(--topbar-input-text);
  border-color: var(--topbar-input-border);
  font-weight: 600;
}
.furniture-counts {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  color: #dbe5f4;
  font-size: 11px;
  white-space: nowrap;
}
.furniture-counts span {
  display: flex;
  align-items: center;
  gap: 5px;
}
.furniture-counts strong {
  min-width: 1.8em;
  padding: 3px 6px;
  border: 1px solid #ffffff30;
  border-radius: 5px;
  background: #ffffff0c;
  color: white;
  text-align: center;
  font-size: 12px;
}
.topbar {
  gap: 16px;
}
.topbar nav {
  display: flex;
  gap: 7px;
}
.topbar nav button {
  background: var(--topbar-nav-background);
  border-color: var(--topbar-input-border);
  color: white;
}
.topbar nav .primary {
  background: var(--topbar-primary-background);
  border-color: var(--topbar-primary-background);
}
.toolbar {
  height: 50px;
  background: var(--toolbar-background);
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  gap: 12px;
}
.toolset {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--toolset-text);
}
.toolset label {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.divider {
  height: 22px;
  border-left: 1px solid var(--line);
  margin: 0 3px;
}
main {
  height: calc(100vh - 122px);
  display: grid;
  grid-template-columns: 230px minmax(280px, 1fr) 260px;
}
aside {
  background: white;
  overflow-y: auto;
}
.inventory {
  background: var(--inventory-background);
  border-right: 1px solid var(--panel-border);
  padding: 22px 16px;
}
.eyebrow {
  font-size: var(--font-small);
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--muted-text);
}
h2 {
  font-size: 18px;
  letter-spacing: -0.4px;
  margin: 7px 0 12px;
}
p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}
.panel-heading p {
  margin-bottom: 24px;
}
.inventory-section {
  font-size: var(--font-small);
  letter-spacing: 1px;
  color: var(--muted-text);
  margin: 20px 0 9px;
  font-weight: bold;
}
.inventory-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  margin-bottom: 8px;
  padding: 11px 9px;
  background: var(--inventory-card-background);
  cursor: grab;
}
.inventory-item:active {
  cursor: grabbing;
}
.inventory-icon {
  width: 33px;
  height: 33px;
  background: #e9eff8;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 23px;
  color: #4c6484;
}
.inventory-copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
}
.inventory-copy small {
  font-weight: normal;
  color: var(--muted);
  font-size: var(--font-small);
}
.inventory-note {
  border: 1px solid var(--inventory-note-border);
  background: var(--inventory-note-background);
  border-radius: 8px;
  padding: 12px;
  margin-top: 25px;
  font-size: 11px;
}
.inventory-note p {
  font-size: 11px;
  margin-bottom: 0;
}
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--workspace-background);
  position: relative;
}
#canvas-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  touch-action: none;
}
#canvas-wrap.scrollbars-enabled {
  overflow: auto;
  touch-action: auto;
}
#canvas {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  touch-action: none;
}
#canvas-wrap.scrollbars-enabled #canvas {
  width: 200%;
  height: 200%;
}
.canvas-scrollbars-toggle {
  position: absolute;
  z-index: 6;
  top: 8px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 6px;
  background: var(--panel, #fff);
  color: var(--text, #334155);
  font-size: 11px;
  cursor: pointer;
  user-select: none;
}
.canvas-scrollbars-toggle input {
  margin: 0;
}
#canvas [data-id] {
  cursor: move;
}
#empty-state {
  position: absolute;
  pointer-events: none;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #ffffffd9;
  padding: 18px 24px;
  border: 1px solid #ffffff;
  border-radius: 10px;
  box-shadow: 0 8px 30px #2436530a;
  white-space: normal;
  max-width: min(520px, calc(100% - 32px));
  line-height: 1.45;
}
#empty-state strong {
  font-size: 15px;
  color: #52627a;
}
#empty-state span {
  font-size: 11px;
  color: #718096;
}
footer {
  height: 32px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  background: var(--footer-background);
  border-top: 1px solid var(--panel-border);
  font-size: var(--font-small);
  color: var(--footer-text);
}
footer > span:last-child {
  white-space: nowrap;
}
.inspector {
  background: var(--panel);
  color: var(--text);
  border-left: 1px solid var(--panel-border);
}
.inspector section {
  padding: 21px 17px;
  border-bottom: 1px solid var(--line);
}
label {
  font-size: 11px;
  font-weight: 600;
  color: var(--label-text);
}
.inspector label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
}
input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--field-border);
  border-radius: 6px;
  padding: 8px;
  background: var(--field-background);
  color: var(--field-text);
  font-size: 12px;
}
input[type='checkbox'] {
  width: auto;
  accent-color: var(--blue);
}
input[type='color'] {
  height: 32px;
  padding: 3px;
  cursor: pointer;
}
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.pair label {
  margin: 8px 0;
}
.pair button {
  margin: 5px 0;
}
.hint {
  color: var(--muted-text);
  font-size: var(--font-small);
  line-height: 1.5;
}
h3 {
  font-size: 12px;
  margin: 20px 0 6px;
}
.badge {
  background: var(--badge-background);
  color: var(--badge-text);
  font-size: 11px;
  border-radius: 6px;
  padding: 3px 7px;
  float: right;
}
.summary div {
  margin-top: 12px;
  font-size: 11px;
  line-height: 1.8;
  color: var(--muted);
}
.summary strong {
  color: var(--text-strong);
}
[hidden] {
  display: none !important;
}
dialog {
  position: fixed;
  inset: auto;
  left: var(--dialog-center-x, 50vw);
  top: var(--dialog-center-y, 50vh);
  margin: 0;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: min(530px, calc(100vw - 32px));
  background: var(--panel-elevated);
  color: var(--dialog-text);
  border: 1px solid var(--dialog-border);
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 20px 70px #101a2f50;
}
dialog::backdrop {
  background: #101a2f80;
}
dialog p {
  font-size: 13px;
}
dialog button {
  float: right;
}
@media (max-width: 1150px) {
  main {
    grid-template-columns: 190px minmax(240px, 1fr) 230px;
  }
  .topbar {
    padding: 0 12px;
    gap: 12px;
  }
  .brand h1 {
    font-size: 15px;
  }
  .toolbar {
    gap: 5px;
    padding: 0 8px;
  }
  .toolbar button {
    padding: 6px;
  }
  .toolset {
    gap: 4px;
  }
  .topbar nav button {
    padding: 7px;
  }
  .inventory {
    padding: 18px 12px;
  }
  footer > span:last-child {
    display: none;
  }
}
@media (max-width: 900px) {
  body {
    overflow: auto;
    min-width: 760px;
  }
  .brand div > span {
    display: none;
  }
  .topbar > input {
    max-width: 180px;
  }
  .furniture-counts {
    gap: 7px;
    font-size: var(--font-small);
  }
  .furniture-counts span {
    gap: 3px;
  }
  .furniture-counts strong {
    font-size: 11px;
    padding: 2px 4px;
  }
  .toolbar {
    height: auto;
    min-height: 50px;
    flex-wrap: wrap;
    padding: 8px;
  }
  main {
    height: calc(100vh - 140px);
  }
  .inventory-copy {
    font-size: var(--font-small);
  }
}

/* Version 0.2: room controls live in a modal; the right panel edits elements. */
body {
  display: flex;
  flex-direction: column;
}
.topbar {
  flex: 0 0 72px;
}
.toolbar {
  flex: 0 0 auto;
  height: auto;
  min-height: 50px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}
main {
  flex: 1;
  min-height: 0;
  height: auto;
  grid-template-columns: 230px minmax(280px, 1fr) 280px;
}
.inspector h2 {
  margin-bottom: 16px;
}
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 10px 0;
}
.action-grid button {
  min-height: 31px;
  font-size: 11px;
  padding: 6px;
}
.element-list-section h3 {
  margin-top: 0;
}
.element-swatch {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 3px;
  border: 1px solid #0002;
}
#paste-empty {
  width: 100%;
  margin-top: 12px;
}
#room-setup {
  color: #1769e0;
  background: #f0f6ff;
  border-color: #bfd4f5;
}
#room-dialog {
  width: 920px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.dialog-heading,
.context-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.dialog-heading h2 {
  margin-bottom: 8px;
}
.dialog-heading button,
.context-heading button {
  float: none;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 20px;
}
.room-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin: 6px 0 15px;
}
.room-settings-grid h3 {
  margin-top: 11px;
}
#room-dialog label,
#context-menu label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
}
#room-dialog .checkbox-label {
  flex-direction: row;
  align-items: center;
  font-size: 11px;
  line-height: 1.5;
}
#room-dialog .hint {
  font-size: 11px;
}
#room-dialog .pair label,
#context-menu .pair label {
  margin: 8px 0;
}
#context-menu {
  position: fixed;
  z-index: var(--z-menu);
  width: 220px;
  max-width: calc(100vw - 16px);
  padding: 10px;
  background: var(--panel-elevated);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 12px 45px #101a2f40;
}
.context-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--context-heading-border);
  padding-bottom: 7px;
}
.context-heading strong {
  font-size: 12px;
  overflow-wrap: anywhere;
}
#context-menu input {
  padding: 6px;
}
.danger {
  color: #b42318;
}
#canvas [data-bleacher]:hover rect {
  stroke: #1769e0;
  stroke-width: 0.3;
}
#canvas [data-bleacher]:focus {
  outline: none;
}
#canvas [data-bleacher]:focus rect {
  stroke: #1769e0;
  stroke-width: 0.4;
}
@media (max-width: 1150px) {
  main {
    grid-template-columns: 190px minmax(240px, 1fr) 250px;
  }
  .toolbar {
    justify-content: flex-start;
    column-gap: 15px;
    row-gap: 8px;
  }
  .topbar > input {
    max-width: 210px;
  }
}
@media (max-width: 900px) {
  main {
    height: auto;
  }
}

#measure[aria-pressed='true'] {
  background: #fff3d6;
  border-color: #b45309;
  color: #92400e;
}
#canvas.measuring,
#canvas.measuring [data-id],
#canvas.measuring [data-bleacher] {
  cursor: crosshair !important;
}

/* Match Field Designer's compact Elements rail and option controls. */
main {
  grid-template-columns: var(--rail-width, 224px) minmax(240px, 1fr) 280px;
}
.inventory {
  padding: 16px;
  background: var(--inventory-background);
}
.panel-heading h2 {
  margin: 0 0 4px;
  font-size: 15px;
}
.panel-heading p {
  margin: 0 0 12px;
  font-size: 11px;
}
.panel-heading .hint {
  margin: 10px 0;
  font-size: var(--font-small);
}
.rail-width-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0;
  gap: 6px;
}
.rail-width-controls span {
  font-size: var(--font-small);
  color: #667085;
}
.rail-width-controls button {
  width: 28px;
  height: 26px;
  padding: 0;
}
#inventory-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.inventory-section {
  grid-column: 1 / -1;
  margin: 12px 0 0;
  font-size: var(--font-small);
}
.inventory-item {
  margin: 0;
  min-width: 0;
  min-height: 98px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 8px 4px;
  border-radius: 9px;
  text-align: center;
  background: var(--inventory-tile-background);
}
.inventory-icon {
  width: 62px;
  height: 40px;
  background: transparent;
}
.inventory-icon svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.inventory-copy {
  font-size: var(--font-small);
  gap: 4px;
}
.inventory-copy small {
  font-size: var(--font-small);
}
.inventory-note {
  margin-top: 18px;
}
.inspector h2 {
  font-size: 16px;
}
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}
.color-swatches button {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid #0003;
  border-radius: 50%;
}
.color-swatches button:hover {
  outline: 2px solid #1769e0;
  outline-offset: 2px;
}
#measure-context {
  position: fixed;
  z-index: var(--z-menu);
  width: 250px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel-elevated);
  color: var(--text);
  box-shadow: 0 12px 30px #0f172a33;
}
#measure-context .danger {
  color: #b42318;
  width: 100%;
}
.measurement-overlay {
  cursor: context-menu;
}
#canvas .rectangle-corner-handle,
#canvas .arrow-corner-handle {
  cursor: grab;
}
#canvas .rectangle-corner-handle:active,
#canvas .arrow-corner-handle:active {
  cursor: grabbing;
}
.measurement-overlay .temporary-measure-endpoint {
  cursor: grab;
  pointer-events: all;
}
.measurement-overlay .temporary-measure-endpoint:active {
  cursor: grabbing;
}
.measurement-overlay .temporary-measure-endpoint:focus,
.measurement-overlay .temporary-measure-close:focus {
  outline: none;
}
.measurement-overlay .temporary-measure-endpoint:focus .temporary-measure-crosshair {
  stroke: #1769e0;
  stroke-width: 3px;
  vector-effect: non-scaling-stroke;
}
.measurement-overlay .temporary-measure-close {
  cursor: pointer;
  pointer-events: all;
}
.measurement-overlay .temporary-measure-close:focus circle {
  stroke: #1769e0;
  stroke-width: 2px;
  vector-effect: non-scaling-stroke;
}
#empty-state {
  bottom: auto;
  transform: translate(-50%, -50%);
  padding: 10px 16px;
}
.topbar nav .primary {
  background: var(--topbar-primary-background);
  border-color: var(--topbar-primary-background);
}
@media (max-width: 1150px) {
  main {
    grid-template-columns: var(--rail-width, 224px) minmax(240px, 1fr) 250px;
  }
}

#court-shadow {
  cursor: pointer;
}
#court-context {
  position: fixed;
  z-index: var(--z-menu);
  width: 280px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel-elevated);
  color: var(--text);
  box-shadow: 0 12px 30px #0f172a33;
}

.theme-control {
  display: flex;
  align-items: center;
  border: 1px solid #ffffff30;
  border-radius: 7px;
  overflow: hidden;
}
.theme-control button {
  padding: 7px 9px;
  background: transparent;
  color: var(--theme-button-text);
  border: 0;
  border-radius: 0;
}
.theme-control button.active {
  background: var(--blue);
  color: white;
}
.color-control-group {
  margin: 14px 0;
  padding: 10px;
  background: var(--color-control-background);
  border: 1px solid var(--color-control-border);
  border-radius: 8px;
}
.color-control-group > strong {
  display: block;
  font-size: 11px;
  margin-bottom: 8px;
}
.color-control-group label {
  margin: 8px 0 2px;
}
.color-control-group .color-swatches {
  margin: 8px 0;
}
.color-swatches button.active {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.color-swatches button.none-swatch {
  width: auto;
  min-width: 42px;
  padding: 0 7px;
  border-radius: 12px;
  color: #172033;
  font-size: var(--font-small);
  line-height: 18px;
  text-shadow: 0 1px white;
}
body.theme-dark .color-swatches button.none-swatch {
  color: #172033;
}
.inventory-item {
  min-height: 112px;
}
.inventory-icon {
  width: 50px;
  height: 32px;
  flex: 0 0 32px;
}
.inventory-copy {
  width: 100%;
  min-width: 0;
  line-height: 1.15;
  overflow-wrap: anywhere;
  gap: 3px;
}
.inventory-copy small {
  line-height: 1.15;
}
.inspector h2 #selection-name {
  overflow-wrap: anywhere;
}
.optional-chair-note {
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0;
}
#style-kind-wrap {
  margin: 12px 0;
}
.alignment-guide {
  filter: drop-shadow(0 0 1px white);
}
/* Keep the editing panel compact, like the focused Field Designer inspector. */
.inspector {
  overflow-y: auto;
}
.inspector section {
  padding: 12px 11px;
}
.inspector .eyebrow {
  font-size: var(--font-small);
}
.inspector h2 {
  font-size: 15px;
  margin: 4px 0 8px;
}
.inspector #selection-empty {
  margin: 5px 0 8px;
  line-height: 1.35;
}
.inspector #selection-controls > label,
.inspector #court-controls > label {
  margin: 7px 0;
  gap: 4px;
}
.inspector input:not([type='color']),
.inspector select {
  padding: 6px;
  height: 30px;
}
.inspector .pair {
  gap: 6px;
}
.inspector .pair label {
  margin: 4px 0;
}
.inspector .action-grid {
  gap: 5px;
}
.inspector .action-grid button,
.inspector .pair button {
  padding: 7px 4px;
  font-size: var(--font-small);
}
.inspector .hint {
  margin: 6px 0;
}
.table-chair-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  margin: 8px 0;
}
.table-chair-row label {
  display: block !important;
  flex: 0 1 auto;
  margin: 0;
  white-space: nowrap;
  font-size: var(--font-small);
  letter-spacing: -0.2px;
}
.table-chair-row input {
  flex: 0 0 62px;
  width: 62px;
  padding: 7px 6px;
}
.inspector .color-control-group {
  margin: 8px 0;
  padding: 7px 8px;
  border-radius: 7px;
}
.inspector .color-control-group > strong {
  font-size: var(--font-small);
  margin-bottom: 4px;
}
.inspector .color-control-group .color-swatches {
  margin: 5px 0;
  gap: 5px;
}
.inspector .color-swatches button {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}
.inspector .color-swatches button.none-swatch {
  width: auto;
  min-width: 38px;
  flex: 0 0 auto;
}
.inspector .color-control-group label {
  margin: 5px 0 0;
}
.inspector input[type='color'] {
  width: 100%;
  height: 27px;
}
.inspector h3 {
  margin: 10px 0 4px;
}
.inspector .badge {
  padding: 2px 6px;
}
.inspector .checkbox-label,
#context-menu .checkbox-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  margin: 7px 0;
  font-size: 11px;
}
.inspector .checkbox-label input,
#context-menu .checkbox-label input {
  flex: 0 0 auto;
}
.object-label {
  fill: #172033;
  stroke: #fff;
  stroke-width: 0.18;
  paint-order: stroke;
  pointer-events: none;
}
.inventory-item {
  min-height: 128px;
  height: auto;
  padding: 7px 6px;
  gap: 5px;
  justify-content: flex-start;
  align-items: stretch;
}
.inventory-icon {
  width: 100%;
  height: 48px;
  flex: 0 0 48px;
  padding: 3px;
  border: 1px solid #d6deea;
  border-radius: 7px;
  background: #edf2f8;
}
.inventory-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}
.inventory-copy {
  display: flex;
  width: 100%;
  min-width: 0;
  flex: 1 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  font-size: var(--font-small);
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
}
.inventory-copy > span {
  display: block;
  width: 100%;
}
.inventory-copy small {
  display: block;
  line-height: 1.15;
  font-size: var(--font-small);
}
body.theme-dark .inventory-icon {
  background: #101a2f;
  border-color: var(--line-icon);
}
body.theme-dark .inventory-icon svg {
  filter: brightness(1.7) contrast(1.2) saturate(1.35) drop-shadow(0 0 1px #e2e8f0);
}
@media (max-width: 1150px) {
  .inventory-item {
    min-height: 124px;
  }
  .inventory-icon {
    height: 44px;
    flex-basis: 44px;
  }
}
main {
  grid-template-columns: var(--rail-width, 230px) minmax(280px, 1fr) 360px;
}
.element-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin: 4px 0 8px;
}
#context-menu .element-actions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 6px 0 0;
}
.element-actions button {
  min-width: 0;
  min-height: 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 4px 2px;
  border-radius: 8px;
  font-size: var(--font-small);
  line-height: 1.1;
  background: #f8fafc;
}
.table-spacing-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-size: 11px;
}
.table-spacing-control input {
  width: 58px;
  min-width: 0;
  padding: 5px;
}
.element-actions .action-icon {
  color: #1769e0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
}
.element-actions button.danger,
.element-actions button.danger .action-icon {
  color: #dc2626;
}
.inspector .element-actions {
  margin-top: 2px;
}
.inspector .color-control-group {
  margin: 5px 0;
  padding: 5px 7px;
  border-radius: 6px;
}
.inspector .color-control-group .color-swatches {
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 3px;
  margin: 4px 0;
}
.inspector .color-swatches button {
  width: 20px;
  height: 20px;
  flex: 0 1 20px;
  min-width: 0;
}
.inspector .color-swatches button.none-swatch {
  min-width: 34px;
  flex: 0 0 34px;
  padding: 0 3px;
  font-size: 8px;
}
.inspector .color-control-group label {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
}
.inspector input[type='color'] {
  width: 100%;
  height: 24px;
}
.inspector .paste-action {
  width: 100%;
  margin: 2px 0 5px;
  padding: 5px;
  font-size: var(--font-small);
}
.option-toggles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px 8px;
  margin: 4px 0 7px;
}
.option-toggles .checkbox-label {
  gap: 5px;
  margin: 2px 0;
  font-size: var(--font-small);
  white-space: nowrap;
}
.context-aux-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 8px 0;
}
.context-aux-actions button {
  padding: 6px;
  font-size: var(--font-small);
}
@media (max-width: 1150px) {
  main {
    grid-template-columns: var(--rail-width, 224px) minmax(240px, 1fr) 290px;
  }
}
@media (max-width: 900px) {
  main {
    grid-template-columns: 190px minmax(240px, 1fr) 290px;
  }
}
body.theme-dark {
  background: #101723;
  color: #e7edf7;
  --text: #e7edf7;
  --accent: #7cb4ff;
  --surface: #182235;
  --surface-soft: #1d2940;
  --panel: #182235;
  --panel-soft: #1d2940;
  --muted-text: #a9b4c6;
  --text-strong: #f3f6fb;
  --line-icon: #56657d;
  --accent-border: #2f5d99;
  --line-strong: #46536a;
  --line-subtle: #3a465b;
  --surface-raised: #222d40;
  --surface-hover: #29364c;
  --panel-elevated: #1b2639;
  --accent-surface: #193963;
  --accent-text: #8fc2ff;
  --error-text: #fca5a5;
  --topbar-background: #090f1c;
  --topbar-input-background: #1e2c42;
  --page-background: #101723;
  --workspace-background: #101723;
  --inventory-background: #151f31;
  --control-background: #222d40;
  --control-border: #46536a;
  --control-hover-background: #29364c;
  --control-hover-border: #46536a;
  --field-background: #222d40;
  --field-border: #71829b;
  --field-text: #e7edf7;
  --field-focus-background: #000000;
  --field-focus-border: #3b82f6;
  --field-focus-ring: #1769e080;
  --toolbar-background: #182235;
  --footer-background: #182235;
  --toolbar-text: #dbe3ef;
  --toolset-text: #465166;
  --dialog-text: #e7edf7;
  --footer-text: #c5cede;
  --panel-border: #3a465b;
  --topbar-input-text: #f3f6fb;
  --topbar-input-border: #71829b;
  --topbar-primary-background: #ff7a1a;
  --badge-background: #193963;
  --badge-text: #8fc2ff;
  --theme-button-text: #dbe3ef;
  --inventory-card-background: #222d40;
  --inventory-tile-background: #222d40;
  --inventory-note-background: #222d40;
  --inventory-note-border: #46536a;
  --color-control-background: #222d40;
  --context-heading-border: #3a465b;
  --topbar-nav-background: #222d40;
  --color-control-border: #46536a;
  --dialog-border: #46536a;
  --label-text: #a9b4c6;
  --muted: #a9b4c6;
}
body.theme-dark .toolbar {
  color: var(--toolbar-text);
}
body.theme-dark
  input:not([type='color']):not([type='checkbox']):not([type='radio']):not([type='range']):not(
    [type='file']
  ),
body.theme-dark select,
body.theme-dark textarea {
  background: var(--field-background);
  color: var(--field-text);
  border-color: var(--field-border);
}
body.theme-dark button:not(.primary):not(.theme-control button) {
  background: var(--control-background);
  color: var(--text);
  border-color: var(--control-border);
}

/* Keep every inventory preview and its two text lines in separate grid rows. */
#inventory-list .inventory-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 56px minmax(2.5em, auto);
  align-content: start;
  justify-items: stretch;
  gap: 4px;
  min-height: 110px;
  height: 110px;
  padding: 8px 7px;
  overflow: hidden;
}
#inventory-list .inventory-icon {
  display: grid;
  place-items: center;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  width: 100%;
  height: 56px;
  min-width: 0;
  min-height: 0;
  flex: none;
  padding: 5px;
  overflow: hidden;
}
#inventory-list .inventory-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
}
#inventory-list .inventory-copy {
  display: contents;
}
#inventory-list .inventory-copy > span {
  display: -webkit-box;
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: var(--font-small);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}
body.theme-dark #inventory-list .inventory-item {
  background: var(--surface-raised);
}
body.theme-dark #inventory-list .inventory-icon {
  background: #101a2f;
}

/* Start with a quiet header; file and layout tools open only when requested. */
.topbar {
  flex-basis: 58px;
  height: 58px;
  gap: 10px;
  padding: 0 14px;
}
.brand {
  gap: 8px;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 13px;
}
.brand h1 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.25px;
}
.brand h1 small {
  margin-left: 4px;
}
.event-title-control {
  display: flex;
  flex: 1 1 220px;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: 130px;
  max-width: 420px;
  margin: 0 auto;
}
.event-title-control > span {
  color: #bac6d9;
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}
.event-title-control > input {
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  margin: 0;
  text-align: left;
}
body.theme-dark .event-title-control > input {
  background: var(--topbar-input-background);
  color: var(--text-strong);
  border-color: var(--line-strong);
}
.file-dropdown {
  position: relative;
  flex: 0 0 auto;
}
.file-dropdown > summary {
  display: block;
  list-style: none;
  cursor: pointer;
  border: 1px solid #ffffff30;
  border-radius: 7px;
  padding: 8px 13px;
  color: #fff;
  background: #ffffff0c;
  font-size: 12px;
  font-weight: 700;
}
.file-dropdown > summary::-webkit-details-marker {
  display: none;
}
.file-dropdown > summary::after {
  content: '⌄';
  margin-left: 8px;
  color: #9eabc1;
}
.file-dropdown[open] > summary {
  background: #26364f;
}
.file-menu {
  position: absolute;
  z-index: var(--z-dropdown);
  top: calc(100% + 6px);
  left: 0;
  display: grid;
  width: 300px;
  gap: 2px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 12px 32px #0005;
}
.file-menu button {
  width: 100%;
  min-height: 34px;
  text-align: left;
  padding: 7px 9px;
}
.file-menu button:not(.primary) {
  background: transparent;
  border-color: transparent;
  color: #172033;
}
.file-menu button:not(.primary):hover {
  background: #eff6ff;
}
.file-submenu > summary {
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 6px;
  color: #172033;
  cursor: pointer;
  list-style: none;
}
.file-submenu > summary::-webkit-details-marker {
  display: none;
}
.file-submenu > summary::after {
  content: '›';
  float: right;
  color: #667085;
}
.file-submenu[open] > summary,
.file-submenu > summary:hover {
  background: #eff6ff;
}
.file-submenu[open] > summary::after {
  transform: rotate(90deg);
}
.file-submenu-actions {
  display: grid;
  gap: 2px;
  padding-left: 12px;
}
.file-menu-separator {
  display: block;
  height: 1px;
  margin: 5px 4px;
  background: #17203320;
}
.current-file-status {
  padding: 1px 5px 3px;
  color: #667085;
  font-size: var(--font-small);
  overflow-wrap: anywhere;
}
#options-toggle {
  flex: 0 0 auto;
  padding: 8px 13px;
  border-color: #ffffff30;
  background: #ffffff0c;
  color: #fff;
}
#options-toggle[aria-expanded='true'] {
  background: #26364f;
}
.fullscreen-button {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border-color: #ffffff20;
  border-radius: 10px;
  background: #ffffff0c;
  color: #fff;
  font-size: 23px;
  line-height: 1;
}
.fullscreen-button:hover {
  background: #26364f;
  border-color: #ffffff50;
}
.toolbar[hidden] {
  display: none !important;
}
.toolbar .theme-control {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.toolbar .theme-control button {
  padding: 6px 8px;
  border: 0;
  border-radius: 0;
}
.toolbar .theme-control button.active {
  background: var(--blue);
  color: #fff;
}
body.theme-dark .file-menu {
  background: var(--panel-elevated);
  border-color: var(--line-strong);
}
body.theme-dark .file-menu button:not(.primary) {
  background: transparent;
  color: var(--text);
}
body.theme-dark .file-menu button:not(.primary):hover {
  background: var(--surface-hover);
}
body.theme-dark .file-submenu > summary {
  color: var(--text);
}
body.theme-dark .file-submenu > summary::after {
  color: var(--muted);
}
body.theme-dark .file-submenu[open] > summary,
body.theme-dark .file-submenu > summary:hover {
  background: var(--surface-hover);
}
body.theme-dark .file-menu-separator {
  background: #ffffff20;
}
body.theme-dark .current-file-status {
  color: #aebbd0;
}
@media (max-width: 1150px) {
  .topbar {
    flex-basis: 58px;
  }
  .brand h1 {
    font-size: 14px;
  }
}
@media (max-width: 900px) {
  main {
    grid-template-columns: var(--rail-width, 230px) minmax(240px, 1fr) 290px;
  }
}
#custom-color-dialog {
  width: 380px;
  max-width: calc(100vw - 28px);
  padding: 20px;
}
#custom-color-dialog .dialog-heading {
  margin-bottom: 18px;
}
#custom-color-dialog .dialog-heading h2 {
  margin: 4px 0 0;
}
.custom-color-entry > label {
  display: block;
  margin: 0 0 7px;
}
.custom-color-value {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}
.custom-color-value input[type='color'] {
  width: 54px;
  height: 42px;
  padding: 3px;
}
.custom-color-value input[type='text'] {
  height: 42px;
  font-family: Consolas, monospace;
  font-size: 15px;
  letter-spacing: 0.4px;
}
#custom-color-error {
  margin: 8px 0 0;
  color: #b42318;
}
.custom-color-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}
.custom-color-actions button {
  min-width: 84px;
}
body.theme-dark #custom-color-error {
  color: var(--error-text);
}
#print-title {
  display: none;
}
#print-summary {
  display: none;
}

.table-team-controls {
  margin: 10px 0;
  padding: 10px 0;
  border-block: 1px solid var(--line);
}
#inventory-list .inventory-item.selected {
  border-color: #3182f6;
  outline: 2px solid #3182f6;
  outline-offset: -2px;
}
.inspector.inventory-selection
  #selection-controls
  > :not(.color-control-group):not(#item-team-options) {
  display: none !important;
}
.table-team-controls > button {
  width: 100%;
}
.team-row-actions {
  display: flex;
  gap: 4px;
}
.team-row-actions button {
  padding: 8px 10px;
}
.roster-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.roster-heading h3 {
  flex-basis: 100%;
  margin: 0 0 4px;
}
#team-roster-panel {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}
#team-roster-panel.drop-ready {
  outline: 3px solid #1769e0;
  background: #1769e01a;
}
#team-roster-cards {
  max-height: 38vh;
  overflow: auto;
}
.roster-card {
  touch-action: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  margin: 5px 0;
  cursor: grab;
}
.roster-first-line {
  display: flex;
  gap: 6px;
  align-items: baseline;
  line-height: 16px;
}
.roster-first-line strong {
  flex-shrink: 0;
  font-size: 12px;
}
.roster-first-line span {
  min-width: 0;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.roster-card small {
  display: block;
  font-size: var(--font-small);
  line-height: 14px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#team-roster-dialog {
  width: 850px;
  max-width: calc(100vw - 32px);
}
.team-import-warning {
  border-left: 4px solid #b27700;
  background: #fff7df;
  color: #523d10;
  padding: 10px 12px;
  margin: 10px 0;
  border-radius: 4px;
}
.theme-dark .team-import-warning {
  border-left-color: #e1ac39;
  background: #3b321f;
  color: #f4e3b6;
}
.roster-import-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 8px 0;
}
.roster-import-actions button {
  float: none;
}
.team-list-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  align-items: center;
}
.roster-exporter-card {
  margin: 8px 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}
.roster-exporter-card > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 10px;
  overflow: hidden;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 600;
  user-select: none;
}
.roster-exporter-card > summary::-webkit-details-marker {
  display: none;
}
.roster-exporter-card > summary::before {
  content: '▸';
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 16px;
}
.roster-exporter-card[open] > summary::before {
  content: '▾';
}
.roster-exporter-content {
  padding: 0 10px 10px;
}
.roster-exporter-card p {
  margin: 6px 0 10px;
  line-height: 1.45;
}
.roster-exporter-card button {
  float: none;
}
.roster-exporter-card ol {
  margin: 8px 0;
  padding-left: 20px;
  font-size: 11px;
  line-height: 1.45;
}
.roster-exporter-card li + li {
  margin-top: 4px;
}
.theme-dark .roster-exporter-card {
  background: #1c2635;
  border-color: #44536a;
}
@media (max-width: 520px) {
}
#team-roster-total {
  font-weight: 600;
  margin: 10px 0 4px;
}
#team-roster-rows {
  max-height: 52vh;
  overflow: auto;
}
.roster-edit-row {
  display: grid;
  grid-template-columns: 28px 90px minmax(140px, 1fr) minmax(140px, 1fr) minmax(160px, 1fr) 36px;
  gap: 8px;
  align-items: center;
  margin: 6px 0;
}
.roster-row-counter {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.theme-dark .roster-row-counter {
  color: #cbd5e1;
}
.theme-dark #team-roster-panel,
.theme-dark .roster-card {
  border-color: #44536a;
}
.theme-dark .roster-card small {
  color: #afbed3;
}
.roster-edit-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  align-self: end;
  height: 32px;
}
.roster-edit-actions button {
  align-self: center;
  height: 32px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #b91c1c;
  border-radius: 5px;
  background: #dc2626;
  color: #fff;
  font-weight: 700;
  line-height: 1;
}
.roster-edit-actions button:hover {
  background: #b91c1c;
}
.roster-edit-actions button:focus-visible {
  outline: 3px solid #f87171;
  outline-offset: 2px;
}
/* These must outrank the generic dark-theme button rules, which would otherwise turn the red
   remove button navy. */
body.theme-dark .roster-edit-actions button:not(.primary):not(.theme-control button) {
  border-color: #f87171;
  background: #b91c1c;
  color: #fff;
}
body.theme-dark .roster-edit-actions button:hover:not(:disabled) {
  background: #991b1b;
}
@media (max-width: 760px) {
  .roster-edit-row {
    grid-template-columns: 28px minmax(92px, 1fr) minmax(120px, 1fr);
  }
  .roster-edit-row label:nth-of-type(3),
  .roster-edit-row label:nth-of-type(4) {
    grid-column: 2 / span 2;
  }
  .roster-edit-actions {
    grid-column: 3;
    grid-row: 1;
    justify-content: end;
  }
}
#team-drag-ghost {
  position: fixed;
  z-index: var(--z-drag);
  pointer-events: none;
  background: #1769e0;
  color: white;
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: bold;
}
.team-placement-cue {
  filter: drop-shadow(0 1px 2px #ffffffcc);
}
.team-placement-cue circle {
  filter: drop-shadow(0 0 2px white);
}

#print-choice-dialog {
  width: 530px;
  max-width: calc(100vw - 32px);
}
#rotate-selection-dialog {
  width: min(350px, calc(100vw - 32px));
  padding: 16px;
}
#rotate-selection-dialog h2 {
  font-size: 16px;
  margin: 0 0 8px;
}
#rotate-selection-dialog > p {
  margin: 0;
  font-size: 11px;
}
#rotate-selection-dialog .custom-color-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
}
#rotate-selection-dialog .custom-color-actions button {
  float: none;
  white-space: normal;
  padding: 7px 9px;
}
#rotate-selection-dialog .custom-color-actions .hint {
  display: block;
  margin-top: 2px;
  font-size: var(--font-small);
  font-weight: normal;
  color: inherit;
}
#print-choice-dialog .custom-color-actions button {
  float: none;
  flex: 1 1 44%;
  white-space: normal;
}
#print-team-report {
  display: none;
}

#inline-team-editor {
  position: fixed;
  z-index: var(--z-popover);
  padding: 3px;
  border: 2px solid #1769e0;
  border-radius: 5px;
  background: var(--panel);
  box-shadow: 0 4px 18px #0005;
}
#inline-team-number {
  width: 100%;
  margin: 0;
  padding: 5px;
  text-align: center;
  font-size: 18px;
}
#inline-annotation-text {
  position: fixed;
  z-index: var(--z-popover);
  transform-origin: 0 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  resize: none;
  overflow: hidden;
  background: transparent;
  text-align: center;
}
#inline-annotation-text[hidden] {
  display: none;
}
#inline-team-error {
  display: block;
  color: #dc4545;
}
#inline-team-error[hidden] {
  display: none;
}

#tools-list #measure-label {
  color: inherit;
}
#tools-list #measure {
  background: #ffffff;
}
#tools-list #measure[aria-pressed='true'] {
  background: #fff3d6;
  border-color: #b45309;
  color: #92400e;
}
#tools-list #measure .inventory-icon img {
  width: 90%;
  height: 90%;
  object-fit: contain;
  filter: none;
}
.temporary-measure-note {
  cursor: grab;
}
.temporary-measure-note:active {
  cursor: grabbing;
}
[data-attached-team] text {
  pointer-events: none;
}
[data-attached-team] [data-team-number-hit] {
  cursor: grab;
}

body.theme-dark #tools-list #measure {
  background: var(--surface-raised);
  color: var(--text);
}
body.theme-dark #tools-list #measure-label {
  color: #ffffff;
}

.rail-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.rail-tabs button {
  flex: 1;
  font-weight: 700;
  padding: 10px 6px;
}
.rail-tabs [aria-selected='true'] {
  border-color: #3182f6;
  box-shadow: inset 0 -3px #3182f6;
}
.team-actions {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}
.team-actions button {
  width: 100%;
  text-align: left;
  font-size: 12px;
  padding: 9px;
}
.team-action-section {
  display: grid;
  gap: 7px;
}
.team-action-section + .team-action-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.team-action-section h3 {
  margin: 0;
  font-size: 13px;
}
.team-step-number {
  color: #ff9800;
  font-weight: 800;
}
.team-action-section .hint {
  margin: 0;
  font-size: 11px;
}
.team-action-section label {
  font-size: 11px;
}
.team-action-section select {
  width: 100%;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
}
#team-roster-panel {
  border: 0;
  padding: 0;
}
#team-roster-cards {
  max-height: none;
}

#inventory-list [data-kind='label'] svg {
  filter: none;
}
#inventory-list [data-kind='label'] svg text {
  fill: #172033;
}
body.theme-dark #inventory-list [data-kind='label'] svg text {
  fill: var(--text);
}

#room-dialog #rotate-room {
  float: none;
  display: block;
  width: 100%;
  margin: 12px 0;
}

#inventory-list [data-kind='field'] svg {
  filter: none;
}
#team-roster-panel.manual-assignment > h2,
#team-roster-panel.manual-assignment .team-actions {
  display: none;
}
#cancel-manual-teams {
  float: none;
  width: 100%;
  margin: 0 0 10px;
}
#clear-teams-dialog {
  width: 460px;
  max-width: calc(100vw - 32px);
}

#team-roster-panel.manual-assignment #return-selected-team:disabled {
  display: none;
}

/* Field Designer style compact color rows; widths are in inches. */
.color-control-group,
.inspector .color-control-group,
body.theme-dark .color-control-group {
  border: 0;
  border-radius: 0;
  background: transparent;
  margin: 6px 0;
  padding: 4px 0;
}
.palette-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.color-control-group .color-swatches,
.inspector .color-control-group .color-swatches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 7px 4px 6px;
}
.color-swatches button,
.inspector .color-swatches button {
  width: 22px;
  height: 22px;
  min-width: 16px;
  flex: 0 1 22px;
  border: 2px solid #4b5563;
  border-radius: 5px;
  box-shadow: 0 0 0 1px #fff;
  padding: 0;
  position: relative;
}
.color-swatches button.active {
  outline: none;
  box-shadow:
    0 0 0 3px #1769e0,
    0 0 0 5px #fff;
  z-index: var(--z-raised);
}
.color-swatches .custom-color-swatch,
body.theme-dark .color-swatches .custom-color-swatch {
  background: conic-gradient(#ef4444, #fbbf24, #22c55e, #1478c8, #a855f7, #ef4444);
  color: white;
  font-size: 20px;
  font-weight: 900;
  line-height: 16px;
  text-shadow: 0 1px 3px #111827;
}
.color-swatches button.none-swatch,
.inspector .color-swatches button.none-swatch,
body.theme-dark .color-swatches button.none-swatch {
  width: 22px;
  min-width: 16px;
  flex: 0 1 22px;
  margin-left: auto;
  background: white;
  border-radius: 5px;
}
.color-swatches .none-swatch::after {
  content: '';
  position: absolute;
  top: 8px;
  left: 2px;
  width: 14px;
  height: 2px;
  background: #dc3545;
  transform: rotate(-45deg);
  border-radius: 2px;
}
.palette-heading .stroke-width-control,
#room-dialog .palette-heading .stroke-width-control,
#context-menu .palette-heading .stroke-width-control {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-size: var(--font-small);
  color: var(--muted);
}
.stroke-width-control > span {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}
.stroke-width-control input,
.inspector .stroke-width-control input,
#context-menu .stroke-width-control input {
  width: 48px;
  min-width: 0;
  border: 0;
  border-radius: 0;
  margin: 0;
  padding: 3px 2px 3px 5px;
  font-size: 11px;
  text-align: right;
}
.stroke-width-control i {
  font-style: normal;
  padding: 0 4px;
}
body.theme-dark .palette-heading {
  color: var(--muted-text);
}
body.theme-dark .color-swatches button {
  border-color: #4b5563;
}

.palette-heading .stroke-width-control,
#room-dialog .palette-heading .stroke-width-control,
#context-menu .palette-heading .stroke-width-control {
  flex-direction: row;
}
.stroke-width-control input,
.inspector .stroke-width-control input,
#context-menu .stroke-width-control input {
  height: 22px;
}
.color-swatches button,
.inspector .color-swatches button {
  width: 26px;
  height: 26px;
  min-width: 26px;
  flex: 0 0 26px;
}
.color-swatches button.none-swatch,
.inspector .color-swatches button.none-swatch,
body.theme-dark .color-swatches button.none-swatch {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
}
.color-swatches .none-swatch::after {
  top: 10px;
  left: 3px;
  width: 17px;
}
.room-settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.room-settings-grid > section,
.color-swatches {
  min-width: 0;
}
.color-swatches .custom-color-swatch,
body.theme-dark .color-swatches .custom-color-swatch {
  background: conic-gradient(#ef4444, #fbbf24, #22c55e, #1478c8, #a855f7, #ef4444) !important;
}
.color-swatches button.none-swatch,
body.theme-dark .color-swatches button.none-swatch {
  background: white !important;
}

#custom-color-dialog {
  border-radius: 16px;
}
#custom-color-dialog .dialog-heading {
  margin-bottom: 4px;
}
.custom-color-shades {
  position: relative;
  width: 100%;
  height: 190px;
  touch-action: none;
  border: 1px solid #cbd3df;
  border-radius: 10px;
  background-image:
    linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent);
  cursor: crosshair;
}
.custom-color-shades > span {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 1px 4px #0f172a99;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.custom-color-hue {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  color: var(--muted);
  font-size: var(--font-small);
  font-weight: 800;
}
.custom-color-hue input {
  width: 100%;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--blue);
  cursor: pointer;
}
.custom-color-previews {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
.custom-color-preview {
  display: grid;
  grid-template-columns: auto 28px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  font:
    700 10px/1 Consolas,
    monospace;
}
.custom-color-preview span {
  font:
    700 9px/1 Arial,
    sans-serif;
  color: var(--muted);
}
.custom-color-preview i {
  width: 28px;
  height: 22px;
  border: 2px solid white;
  border-radius: 6px;
  box-shadow: 0 0 0 1px #c5cad3;
}
.custom-color-preview input {
  width: 100%;
  height: 24px;
  min-width: 0;
  padding: 2px;
  margin: 0;
  font:
    700 10px/1 Consolas,
    monospace;
}
.tape-end-handle {
  cursor: crosshair;
  touch-action: none;
}

#team-style-dialog {
  width: 410px;
  max-width: calc(100vw - 32px);
}
#team-style-dialog .color-control-group {
  margin: 12px 0;
}

.ruler-guide-strips [data-ruler-side='top'],
.ruler-guide-strips [data-ruler-side='bottom'] {
  cursor: ew-resize;
}
.ruler-guide-strips [data-ruler-side='left'],
.ruler-guide-strips [data-ruler-side='right'] {
  cursor: ns-resize;
}

/* Keep ruler controls readable when the Options toolbar wraps. */
#layout-options {
  height: auto;
  min-height: 50px;
  flex-wrap: wrap;
  padding-top: 7px;
  padding-bottom: 7px;
}
#layout-options .toolset {
  flex-wrap: wrap;
}
.ruler-origin-control select {
  width: 105px;
  padding: 5px;
}

#room-dialog #bleacher-controls {
  min-width: 0;
  border: 0;
  padding: 0;
  margin: 0;
}
#room-dialog #bleacher-controls legend {
  padding: 0;
  font-size: 13px;
  font-weight: 700;
}

/* Keep both element editors in the same compact, predictable order. */
.inspector #selection-controls > section,
#context-menu > section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 10px;
  margin: 4px 0;
  padding: 5px 0;
  border: 0;
}
.inspector #selection-controls > #portable-bleacher-options {
  display: block;
}
#item-screen-feet-options > .color-control-group,
#item-screen-feet-options > .hint,
#portable-bleacher-options > .hint {
  grid-column: 1 / -1;
}
#item-measurement-options > label:first-child,
#item-measurement-options > .hint,
#item-question-options > .color-control-group {
  grid-column: 1 / -1;
}
#item-annotation-options > label:first-child,
#item-annotation-options > .color-control-group,
#item-annotation-options > .hint {
  grid-column: 1 / -1;
}
#item-annotation-options label {
  margin: 2px 0;
  gap: 3px;
}
#item-annotation-text {
  box-sizing: border-box;
  width: 100%;
  min-height: 5em;
  resize: vertical;
}
#item-measurement-options label,
#item-question-options label {
  margin: 2px 0;
  gap: 3px;
}
.inspector #selection-controls > label:not(.checkbox-label),
#context-menu > label:not(.checkbox-label) {
  margin: 4px 0;
  gap: 3px;
}
#context-style-kind-wrap {
  margin: 4px 0;
}
.inspector .color-control-group,
#context-menu .color-control-group {
  margin: 3px 0;
  padding: 3px 0;
}
.inspector .color-control-group .color-swatches,
#context-menu .color-control-group .color-swatches {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 7px;
  margin: 5px 0;
}
.inspector .color-control-group .color-swatches button,
#context-menu .color-control-group .color-swatches button {
  box-sizing: border-box;
  width: 17px;
  height: 17px;
  min-width: 17px;
  flex: 0 0 17px;
  border-radius: 3px;
}
.inspector .color-control-group .color-swatches button.none-swatch,
#context-menu .color-control-group .color-swatches button.none-swatch {
  width: 17px;
  min-width: 17px;
  flex: 0 0 17px;
  margin-left: 0;
  height: 17px;
  padding: 0;
}
.inspector .color-control-group .color-swatches .custom-color-swatch,
#context-menu .color-control-group .color-swatches .custom-color-swatch {
  font-size: 14px;
  line-height: 14px;
}
.inspector .palette-heading,
#context-menu .palette-heading {
  font-size: var(--font-small);
}
.inspector .option-toggles,
#context-menu .option-toggles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 8px;
  margin: 3px 0 5px;
}
.inspector .option-toggles .checkbox-label,
#context-menu .option-toggles .checkbox-label {
  min-width: 0;
  white-space: normal;
  align-items: flex-start;
  gap: 5px;
  margin: 1px 0;
  font-size: var(--font-small);
  line-height: 1.25;
}
.inspector .option-toggles input,
#context-menu .option-toggles input {
  margin-top: 1px;
}
.inspector #selection-controls input:not([type='color']):not([type='checkbox']),
.inspector #selection-controls select,
#context-menu input:not([type='color']):not([type='checkbox']),
#context-menu select {
  height: 27px;
  padding: 4px 6px;
  font-size: 11px;
}
.inspector #selection-controls .pair,
#context-menu .pair {
  gap: 6px;
}
.inspector #selection-controls .pair label,
#context-menu .pair label {
  margin: 3px 0;
  gap: 3px;
}
.inspector #selection-controls .hint,
#context-menu .hint {
  margin: 3px 0;
  font-size: var(--font-small);
  line-height: 1.35;
}
.inspector #selection-controls h3,
#context-menu h3 {
  margin: 5px 0 2px;
}
.inspector #selection-controls .table-team-controls,
#context-menu .table-team-controls {
  margin: 4px 0;
  padding: 4px 0;
}
.inspector #selection-controls .table-chair-row,
#context-menu .table-chair-row {
  margin: 3px 0;
}
.inspector #selection-controls .element-actions button,
#context-menu .element-actions button {
  min-height: 38px;
}
#context-menu {
  width: min(220px, calc(100vw - 16px));
  padding: 10px;
}
.rotation-presets label {
  min-width: 0;
}
.rotation-presets input[readonly] {
  background: var(--panel-soft);
  cursor: default;
  appearance: textfield;
}
.rotation-presets input[readonly]::-webkit-inner-spin-button,
.rotation-presets input[readonly]::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}
.inspector #selection-controls .placement-actions,
#context-menu .placement-actions {
  margin: 4px 0 6px;
}
.rotation-divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 6px 0;
}

/* Group table setup, label visibility, seating, and movement controls into clear sections. */
.inspector #selection-controls .table-team-controls,
#context-menu .table-team-controls {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  column-gap: 9px;
  border-top: 0;
  border-bottom: 1px solid var(--line);
}
.inspector #selection-controls .table-team-controls .checkbox-label,
#context-menu .table-team-controls .checkbox-label {
  grid-column: auto;
  margin: 0;
  white-space: nowrap;
}
.inspector #selection-controls .table-team-controls .hint,
#context-menu .table-team-controls .hint {
  grid-column: auto;
  margin: 0;
  font-size: var(--font-small);
  line-height: 1.25;
}
.inspector #selection-controls .label-edit-row,
#context-menu .label-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  margin: 5px 0;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}
.inspector #selection-controls .label-edit-row > label:not(.checkbox-label),
#context-menu .label-edit-row > label:not(.checkbox-label) {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  margin: 0;
  font-size: var(--font-small);
}
.inspector #selection-controls .label-edit-row .label-visibility-row,
#context-menu .label-edit-row .label-visibility-row {
  align-self: end;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  height: 27px;
  margin: 0;
  padding: 0;
  white-space: nowrap;
  font-size: var(--font-small);
  line-height: 1.2;
}
.inspector #selection-controls .label-visibility-row input,
#context-menu .label-visibility-row input {
  margin: 0;
}
.inspector #selection-controls .option-toggles,
#context-menu .option-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin: 0 0 4px;
}
.inspector #selection-controls #table-seating-options {
  margin: 2px 0;
  padding: 2px 0;
  border: 0;
}
#booth-furniture-options {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
#booth-furniture-options h3,
#booth-furniture-options .hint {
  grid-column: 1 / -1;
}
#booth-table-length,
#booth-chair-count {
  width: 100%;
  min-width: 0;
}
.inspector #selection-controls .table-chair-heading,
#context-menu .table-chair-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 6px;
}
.chair-layout-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.inspector #selection-controls .table-chair-heading h3,
#context-menu .table-chair-heading h3 {
  margin: 0;
  font-size: var(--font-small);
  line-height: 1.2;
  white-space: nowrap;
}
.inspector #selection-controls .table-chair-heading .checkbox-label,
#context-menu .table-chair-heading .checkbox-label {
  margin: 0;
  gap: 4px;
  white-space: nowrap;
  font-size: var(--font-small);
  line-height: 1.2;
}
.inspector #selection-controls .table-chair-heading input,
#context-menu .table-chair-heading input {
  margin: 0;
}
.inspector #selection-controls .table-chair-row,
#context-menu .table-chair-row {
  margin: 2px 0;
}
.inspector #selection-controls .rotation-alignment-group,
#context-menu .rotation-alignment-group {
  border-top: 1px solid var(--line);
  padding-top: 5px;
  margin-top: 5px;
}
.inspector #selection-controls .rotation-alignment-toggles,
#context-menu .rotation-alignment-toggles {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 5px;
}
.inspector #selection-controls .rotation-alignment-toggles .checkbox-label,
#context-menu .rotation-alignment-toggles .checkbox-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  margin: 0;
  white-space: nowrap;
  font-size: var(--font-small);
}

/* Keep the rail tabs visible while each tab's content scrolls independently. */
.inventory {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.rail-tabs {
  flex: 0 0 auto;
}
#elements-panel,
#team-roster-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.color-swatches .none-swatch::after {
  inset: 2px;
  top: 2px;
  left: 2px;
  width: auto;
  height: auto;
  transform: none;
  clip-path: polygon(0 88%, 88% 0, 100% 0, 12% 100%);
}
@media (max-width: 900px) {
  .event-title-control {
    max-width: 210px;
  }
}
@media (max-width: 850px) {
  .topbar {
    gap: 4px;
    padding-inline: 8px;
  }
  .brand {
    gap: 5px;
  }
  .brand h1 {
    font-size: 12px;
  }
  .brand h1 small {
    display: none;
  }
  .event-title-control {
    min-width: 80px;
    flex-basis: 100px;
    gap: 4px;
  }
  .event-title-control > span {
    display: none;
  }
  .furniture-counts {
    gap: 4px;
    font-size: var(--font-small);
  }
  .furniture-counts span {
    gap: 2px;
  }
  .furniture-counts strong {
    min-width: 1.4em;
    padding: 2px 3px;
    font-size: var(--font-small);
  }
}

/* Laptop layouts: preserve a useful drawing area and keep dialogs inside the viewport. */
@media (min-width: 761px) and (max-width: 1150px) {
  main {
    grid-template-columns: minmax(176px, min(20vw, 220px)) minmax(320px, 1fr) minmax(240px, 300px);
  }
  .topbar {
    gap: 8px;
    padding-inline: 10px;
  }
  .event-title-control {
    flex-basis: 120px;
    min-width: 90px;
    max-width: 260px;
  }
  .furniture-counts {
    gap: 6px;
  }
  .toolbar {
    column-gap: 12px;
  }
}
/* From 761 to 850px the laptop rules above would undo the compact header; restate it here, after
   them, so the header fits (the 11px minimum text size made it about 16px wider). */
@media (min-width: 761px) and (max-width: 850px) {
  .topbar {
    gap: 4px;
    padding-inline: 8px;
  }
  .event-title-control {
    flex-basis: 100px;
    min-width: 70px;
  }
  .furniture-counts {
    gap: 4px;
  }
}

dialog {
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

#current-file-status[data-dirty='true'] {
  color: #fbbf24;
  font-weight: 700;
}
#unsaved-dialog,
#editor-lock-dialog {
  width: min(460px, calc(100vw - 32px));
}
#recover-drafts-dialog {
  width: min(620px, calc(100vw - 32px));
}
.recover-drafts-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}
.recover-drafts-list li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.recover-drafts-list li span {
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
}

@media (max-height: 760px) {
  .inventory,
  .inspector section {
    padding-top: 12px;
    padding-bottom: 12px;
  }
  #room-dialog,
  #team-roster-dialog {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }
}

/* Let the saved rail preference contract smoothly as the laptop canvas narrows. */
@media (max-width: 1150px) {
  main {
    grid-template-columns:
      min(var(--rail-width, 230px), max(176px, calc(100vw - 760px))) minmax(320px, 1fr)
      minmax(220px, min(280px, calc(100vw - 540px)));
  }
}

/* User-sized panels keep the drawing area usable at laptop widths. */
main {
  grid-template-columns:
    minmax(176px, var(--rail-width, 230px)) 10px minmax(320px, 1fr)
    10px minmax(220px, var(--inspector-width, 360px));
}
.inventory {
  grid-column: 1;
}
.workspace {
  grid-column: 3;
}
.inspector {
  grid-column: 5;
}
.panel-splitter {
  grid-row: 1;
  width: 10px;
  min-width: 10px;
  align-self: stretch;
  cursor: col-resize;
  touch-action: none;
  background: linear-gradient(to right, transparent 4px, #c5cedb 4px, #c5cedb 6px, transparent 6px);
}
#rail-splitter {
  grid-column: 2;
}
#inspector-splitter {
  grid-column: 4;
}
.panel-splitter:hover,
.panel-splitter:focus-visible,
.panel-splitter:active {
  background: linear-gradient(to right, transparent 3px, #1769e0 3px, #1769e0 7px, transparent 7px);
  outline: none;
}
body.theme-dark .panel-splitter {
  background: linear-gradient(to right, transparent 4px, #59677d 4px, #59677d 6px, transparent 6px);
}
body.theme-dark .panel-splitter:hover,
body.theme-dark .panel-splitter:focus-visible,
body.theme-dark .panel-splitter:active {
  background: linear-gradient(to right, transparent 3px, #60a5fa 3px, #60a5fa 7px, transparent 7px);
}
#inventory-list .inventory-item {
  grid-template-rows: var(--inventory-icon-height, 48px) minmax(2.4em, auto);
  min-height: var(--inventory-tile-height, 110px);
  height: auto;
  padding: 7px;
}
#inventory-list .inventory-icon {
  height: 100%;
}

/* Make the close-to clearing action easy to spot in the native team select menu. */
.clear-team-option {
  background-color: #dc2626;
  color: #fff;
}

/* Guide link and bundled sample chooser. */
.user-guide-link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #ffffff30;
  border-radius: 7px;
  background: #ffffff0c;
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.user-guide-link:hover {
  border-color: #ffffff70;
  background: #26364f;
}
.user-guide-link:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.user-guide-icon {
  font-size: 16px;
  line-height: 1;
}
#sample-layout-dialog {
  width: min(560px, calc(100vw - 32px));
}
.sample-layout-choice-grid {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}
.sample-layout-choice-grid button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  width: 100%;
  padding: 12px 14px;
  text-align: left;
}
.sample-layout-choice-grid button strong {
  font-size: 14px;
}
.sample-layout-choice-grid button span {
  color: #667085;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
}
body.theme-dark .sample-layout-choice-grid button {
  background: var(--surface-raised);
  color: var(--text);
  border-color: var(--line-strong);
}
body.theme-dark .sample-layout-choice-grid button span {
  color: var(--muted-text);
}
/* The header has no spare room below about 1150px: show the guide link as an icon. */
@media (max-width: 1150px) {
  .user-guide-link {
    flex: 0 0 36px;
    width: 36px;
    min-height: 36px;
    height: 36px;
    padding: 0;
  }
  .user-guide-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}
/* From 851 to 1150px the icon alone is not enough: also drop the Event title caption and
   tighten the gaps, so the Full screen button stays inside the viewport. */
@media (min-width: 851px) and (max-width: 1150px) {
  .topbar {
    gap: 4px;
  }
  .event-title-control {
    min-width: 70px;
  }
  .event-title-control > span {
    display: none;
  }
}
@media (max-width: 850px) {
  .event-title-control {
    flex-basis: 90px;
    min-width: 70px;
    max-width: 140px;
  }
  .event-title-control input {
    min-width: 0;
  }
}
@media (max-width: 420px) {
  #sample-layout-dialog {
    padding: 16px;
  }
  .sample-layout-choice-grid button {
    padding: 10px;
  }
}

.room-shape-section {
  border: 1px solid #d9e3f2;
  border-radius: 8px;
  padding: 10px;
  margin: 14px 0;
  background: var(--panel-soft);
}
.room-shape-section h3 {
  margin: 2px 0 8px;
}
.room-shape-section label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 9px 0;
}
.room-shape-section .pair {
  gap: 7px;
}
.room-shape-section .pair label {
  margin: 5px 0;
}
.room-shape-section input,
.room-shape-section select {
  padding: 6px;
  font-size: 11px;
}
.room-shape-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.room-shape-error {
  color: #a11b1b;
  background: #fff1f0;
  border: 1px solid #f2b8b5;
  border-radius: 5px;
  padding: 7px;
  margin: 8px 0;
}
.room-boundary-warning {
  color: #8a4b00;
  font-size: var(--font-small);
  line-height: 1.4;
  padding: 7px 8px;
  margin: 8px 0;
  background: #fff7e8;
  border: 1px solid #f2d29a;
  border-radius: 6px;
}
.room-region-editor {
  border: 1px solid #dce3ee;
  border-radius: 6px;
  padding: 8px;
  margin: 8px 0;
  background: white;
}
.room-region-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
}
.room-region-heading button {
  padding: 4px 7px;
}
#room-draw-outline[aria-pressed='true'] {
  color: white;
  background: #1769e0;
  border-color: #1769e0;
}
#canvas[data-room-drawing='true'] {
  cursor: crosshair;
}
@media (max-width: 900px) {
  .room-settings-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
.room-outline-draw-toolbar {
  position: absolute;
  z-index: var(--z-canvas-tools);
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  max-width: calc(100% - 24px);
  padding: 9px 11px;
  border: 1px solid #b9c9df;
  border-radius: 8px;
  background: #fffffff2;
  box-shadow: 0 4px 18px #101a2f24;
  font-size: 11px;
}
.room-outline-draw-toolbar span {
  color: #667085;
}
.room-outline-draw-toolbar button {
  padding: 5px 8px;
}
footer #room-boundary-warning {
  font-size: var(--font-small);
  line-height: 1.2;
  padding: 2px 6px;
  margin: 0;
  border: 1px solid #f2d29a;
  white-space: nowrap;
}
@media (max-width: 900px) {
  .room-outline-draw-toolbar {
    left: 8px;
    transform: none;
  }
  footer #room-boundary-warning {
    white-space: normal;
  }
}

.ftclive-import-panel {
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}
.ftclive-import-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 12px;
  align-items: end;
}
.ftclive-import-fields label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
}
.ftclive-import-fields input {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.ftclive-import-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
.ftclive-import-actions button {
  float: none;
}
.theme-dark .ftclive-import-panel {
  background: #202838;
}
@media (max-width: 620px) {
  .ftclive-import-fields {
    grid-template-columns: 1fr;
  }
}
.ftclive-event-actions {
  display: flex;
  justify-content: flex-end;
  margin: 8px 0;
}
.ftclive-event-actions button {
  float: none;
}

.ftclive-import-fields #ftclive-event-code {
  width: 100%;
  min-height: 2.5em;
  padding: 5px 7px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line, #cbd3df);
  border-radius: 6px;
  font: inherit;
}
.ftclive-import-fields #ftclive-event-code option {
  padding: 3px 5px;
}
.theme-dark .ftclive-import-fields #ftclive-event-code {
  color: var(--text);
  background: #161d29;
  border-color: #475366;
}

/* Table catalog placement choices and transient group-drawing guidance. */
.inventory-table-card {
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  gap: 2px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  padding-bottom: 5px;
}
#inventory-list .inventory-table-card > .inventory-item {
  border: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  min-height: 0;
  height: auto;
  grid-template-rows: var(--inventory-icon-height, 48px) auto;
  padding: 7px 7px 3px;
}
.inventory-table-card .inventory-table-actions {
  margin: 0 5px;
}
.inventory-table-card:has(.inventory-item.selected) {
  border-color: #3182f6;
  box-shadow: inset 0 0 0 1px #3182f6;
}
#inventory-list .inventory-table-card > .inventory-item.selected {
  outline: none;
}
body.theme-dark .inventory-table-card {
  background: var(--surface-raised);
  border-color: var(--line-strong);
}
body.theme-dark .inventory-table-card:has(.inventory-item.selected) {
  border-color: #3182f6;
}
.inventory-table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.inventory-table-actions button {
  flex: 1 1 28px;
  min-width: 0;
  padding: 4px 2px;
  font-size: var(--font-small);
  line-height: 1.2;
}
.table-group-placement {
  position: absolute;
  z-index: var(--z-canvas-tools);
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #b9c9df;
  border-radius: 8px;
  background: #fffffff2;
  color: #172033;
  box-shadow: 0 4px 18px #101a2f24;
  font-size: 11px;
}
.table-group-placement button {
  flex: 0 0 auto;
  padding: 5px 8px;
}
#table-placement-dialog {
  width: min(480px, calc(100vw - 32px));
  border: 3px solid #a66b00;
  box-shadow:
    0 18px 54px #1114,
    0 0 0 3px #f5c54255;
}
#table-placement-dialog .table-placement-team-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 20px 0 27px;
  font-weight: 600;
}
#table-placement-dialog .table-placement-team-label input {
  margin: 0;
}
#table-placement-dialog .table-placement-chair-question {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  align-items: center;
  column-gap: 14px;
  row-gap: 5px;
  margin: 0 0 10px;
}
#table-placement-dialog .table-placement-chair-question label {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
}
#table-placement-dialog .table-placement-chair-question input {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 100%;
}
#table-placement-dialog #table-placement-chair-range {
  grid-column: 1;
  margin: 0;
}
body.theme-dark #table-placement-dialog {
  border-color: #f5c542;
  box-shadow:
    0 18px 54px #0009,
    0 0 0 3px #f5c54255;
}
#table-group-dialog {
  width: min(440px, calc(100vw - 32px));
  border: 3px solid #a66b00;
  box-shadow:
    0 18px 54px #1114,
    0 0 0 3px #f5c54255;
}
#table-group-dialog > label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  align-items: center;
  gap: 14px;
}
body.theme-dark #table-group-dialog {
  border-color: #f5c542;
  box-shadow:
    0 18px 54px #0009,
    0 0 0 3px #f5c54255;
}
#table-group-error {
  color: #b42318;
}
body.theme-dark .table-group-placement {
  background: var(--surface-raised) f2;
  color: var(--text);
  border-color: #59677d;
}

/* Windows high-contrast and other forced-colour modes: the drawing and the colour swatches show
   the event's real colours, and focus stays visible (AUDIT CSS-2). */
@media (forced-colors: active) {
  #canvas,
  .inventory-icon svg,
  .color-swatches button {
    forced-color-adjust: none;
  }
  :focus-visible {
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }
}

/* Custom outline tool: drawn corners, the wall following the pointer, edit handles and the
   wall-length boxes along the walls. Sizes are in screen pixels at any zoom. */
#canvas[data-room-drawing] {
  cursor: crosshair;
}
.room-outline-draft {
  fill: #1769e014;
  stroke: #1769e0;
}
.room-outline-rubber {
  fill: none;
  stroke: #1769e0;
}
.room-outline-corner {
  fill: #fff;
  stroke: #1769e0;
}
.room-outline-corner.closing {
  fill: #1769e0;
}
.room-outline-handle {
  fill: #fff;
  stroke: #1769e0;
  cursor: move;
}
.room-outline-handle:hover {
  fill: #dbeafe;
}
.room-outline-length,
.room-outline-angle {
  font-weight: 700;
  paint-order: stroke;
  stroke: #fff;
  pointer-events: none;
}
.room-outline-length {
  fill: #0f3d91;
}
.room-outline-angle {
  fill: #9a3412;
}
.room-outline-lengths {
  position: absolute;
  inset: 0;
  z-index: var(--z-canvas-tools);
  pointer-events: none;
}
.room-outline-length-input {
  position: absolute;
  width: 62px;
  padding: 2px 4px;
  transform: translate(-50%, -50%);
  border: 1px solid #93b4e0;
  border-radius: 5px;
  background: #ffffffee;
  color: #0f3d91;
  font-size: var(--font-small);
  font-weight: 700;
  text-align: center;
  pointer-events: auto;
}
body.theme-dark .room-outline-length-input {
  border-color: #56657d;
  background: #101a2fee;
  color: var(--text);
}
.room-outline-draw-toolbar strong {
  color: #172033;
}
body.theme-dark .room-outline-draw-toolbar {
  border-color: #56657d;
  background: #1b2538f2;
}
body.theme-dark .room-outline-draw-toolbar strong {
  color: #f8fafc;
}
body.theme-dark .room-outline-draw-toolbar span {
  color: #b6c2d4;
}

/* Rulers are brighter on the dark canvas. */
body.theme-dark #room-rulers .room-ruler-ticks {
  stroke: #b4c0d3;
}
body.theme-dark #room-rulers .room-ruler-labels {
  fill: #dbe3ee;
}

/* Multi-room events: the Room menu floats in the drawing's top-left corner (the default view
   keeps the room and its rulers below it), and Room setup lists the rooms. */
.room-switcher {
  position: absolute;
  z-index: var(--z-canvas-tools);
  top: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid #b9c9df;
  border-radius: 8px;
  background: #fffffff2;
  box-shadow: 0 4px 18px #101a2f24;
}
.room-switcher[hidden] {
  display: none;
}
.room-switcher > span {
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
.room-switcher > select {
  min-width: 140px;
  max-width: 220px;
  margin: 0;
}
body.theme-dark .room-switcher {
  border-color: #59677d;
  background: var(--surface-raised) f2;
}
body.theme-dark .room-switcher > span {
  color: #cbd5e1;
}
body.theme-dark .room-switcher > select {
  border-color: var(--line-strong);
  background: var(--topbar-input-background);
  color: var(--text-strong);
}

.event-rooms-section {
  margin: 0 0 12px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
}
.event-rooms-section h3 {
  margin: 0 0 4px;
}
.event-room-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}
.event-room-select {
  width: 100%;
  text-align: left;
}
#room-dialog .event-room-row.selected .event-room-select {
  color: var(--accent-text);
  background: var(--accent-surface);
  border: 2px solid #1769e0;
  font-weight: 700;
}
#room-dialog .event-room-remove {
  width: 32px;
  height: 32px;
  padding: 0;
  color: #dc2626;
  border: 1px solid #dc2626;
  font-size: 22px;
  line-height: 1;
}
#room-dialog .event-room-remove:hover {
  background: #dc2626;
  color: white;
}
#room-dialog .event-room-remove:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.event-room-actions {
  display: flex;
  gap: 6px;
}
.event-room-head span {
  color: var(--muted-text);
  font-size: var(--font-small);
  font-weight: 600;
}
.event-room-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.event-room-name input {
  flex: 1 1 auto;
  min-width: 0;
}
.event-room-row > input,
.event-room-name input {
  margin: 0;
}
@media (max-width: 840px) {
  .event-room-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .event-room-head {
    display: none;
  }
  .event-room-actions {
    grid-column: 1 / -1;
  }
}
/* Print → All rooms: one page per room, each titled with its name. */
.print-rooms {
  display: none;
}

.print-paper-size-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 12px;
  font-weight: 600;
}
.print-paper-size-control select {
  min-width: 8rem;
}
.print-room-scope {
  margin: 8px 0 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.print-room-scope legend {
  padding: 0 4px;
  font-size: var(--font-small);
  font-weight: 700;
}
.print-room-scope label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}
.print-room-scope input[type='radio'] {
  width: auto;
  margin: 0;
}
/* A box that cannot take the group turns the placement banner orange until the next try. */
.table-group-placement.warning {
  border-color: #f59e0b;
  background: #fff7e6f2;
  color: #7c2d12;
  font-weight: 700;
}
body.theme-dark .table-group-placement.warning {
  border-color: #f59e0b;
  background: #3b2a12f2;
  color: #fde68a;
}
/* Outline drawing and editing, and table-group placement, use the top of the drawing. */
#canvas-wrap:has(
    #room-outline-draw-toolbar:not([hidden]),
    #room-outline-edit-toolbar:not([hidden]),
    #table-group-placement:not([hidden])
  )
  #room-switcher {
  display: none;
}

/* My elements: the user's custom elements below the catalog tiles, sized like them. */
.my-elements {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.my-elements-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 8px;
}
.my-elements-heading h3 {
  margin: 0;
  font-size: 13px;
}
.my-elements-heading button {
  padding: 5px 9px;
  font-size: var(--font-small);
  color: #1769e0;
  background: #f0f6ff;
  border-color: #bfd4f5;
}
#my-elements-empty {
  margin: 8px 0 0;
}
#my-elements-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
#my-elements-list:empty {
  display: none;
}
.custom-element-card {
  position: relative;
  min-width: 0;
}
#my-elements-list .inventory-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--inventory-icon-height, 48px) auto;
  align-content: start;
  justify-items: stretch;
  gap: 4px;
  width: 100%;
  min-height: var(--inventory-tile-height, 110px);
  height: auto;
  padding: 7px;
  overflow: hidden;
}
#my-elements-list .inventory-icon {
  display: grid;
  place-items: center;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 4px;
  overflow: hidden;
}
#my-elements-list .inventory-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  /* Show the user's own picture in its real colours in either theme. */
  filter: none;
}
#my-elements-list .inventory-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
#my-elements-list .inventory-copy > span {
  display: -webkit-box;
  width: 100%;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: var(--font-small);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}
#my-elements-list .inventory-copy small {
  color: var(--muted-text);
  font-size: var(--font-small);
  font-weight: 600;
}
#my-elements-list .inventory-item.selected {
  border-color: #3182f6;
  outline: 2px solid #3182f6;
  outline-offset: -2px;
}
.custom-element-menu-button {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 24px;
  height: 22px;
  padding: 0;
  border-radius: 6px;
  font-size: 15px;
  line-height: 1;
  background: #ffffffe6;
}
.custom-element-menu {
  position: fixed;
  z-index: var(--z-menu);
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 220px;
  max-width: calc(100vw - 16px);
  padding: 10px;
  border: 1px solid #cbd3df;
  border-radius: 10px;
  background: white;
  box-shadow: 0 12px 30px #0f172a33;
}
.custom-element-menu-title {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.custom-element-menu button {
  width: 100%;
  text-align: left;
}
body.theme-dark .my-elements {
  border-color: var(--line-subtle);
}
body.theme-dark .my-elements-heading h3 {
  color: var(--text);
}
body.theme-dark .my-elements-heading button:not(:hover) {
  background: var(--accent-surface);
  color: var(--accent-text);
  border-color: var(--accent-border);
}
body.theme-dark #my-elements-list .inventory-item {
  background: var(--surface-raised);
}
body.theme-dark #my-elements-list .inventory-icon {
  background: #dfe5ee;
  border-color: #56657d;
}
body.theme-dark #my-elements-list .inventory-copy small {
  color: var(--muted-text);
}
body.theme-dark .custom-element-menu-button:not(:hover) {
  background: var(--panel-elevated) e6;
}
body.theme-dark .custom-element-menu {
  background: var(--panel-elevated);
  color: var(--text);
  border-color: var(--line-strong);
}
body.theme-dark .custom-element-menu-title {
  border-color: var(--line-subtle);
}
#custom-element-menu button.danger {
  color: #b42318;
}
body.theme-dark #custom-element-menu button.danger {
  color: var(--error-text);
}

/* New element / Edit element dialog. */
#custom-element-dialog {
  width: min(640px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
}
#custom-element-dialog > .hint {
  margin: 0 0 10px;
}
.custom-element-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  gap: 18px;
  align-items: start;
}
.custom-element-fields > label,
.custom-element-fields .pair label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 10px;
}
.custom-element-fields .pair {
  gap: 10px;
}
.custom-element-fields .color-control-group {
  margin: 0 0 10px;
}
.custom-element-preview {
  display: grid;
  place-items: center;
  height: 200px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4efe4;
}
.custom-element-preview svg {
  display: block;
  width: 100%;
  height: 100%;
}
.custom-element-image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.custom-element-image-actions button {
  float: none;
  flex: 1 1 auto;
}
#custom-element-image-status {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}
#custom-element-update-layout-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
}
.custom-element-error {
  margin: 10px 0 0;
  color: #b42318;
  font-size: 12px;
}
body.theme-dark .custom-element-preview {
  background: #dcd5c6;
  border-color: var(--line-strong);
}
body.theme-dark .custom-element-error {
  color: var(--error-text);
}
@media (max-width: 620px) {
  .custom-element-editor {
    grid-template-columns: minmax(0, 1fr);
  }
  .custom-element-preview {
    height: 160px;
  }
}

/* Selected custom element in Element Options. */
.custom-element-inspector {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  margin: 8px 0;
}
.custom-element-inspector .hint {
  flex: 1 1 140px;
  margin: 0;
}

/* Check spacing is a toggle while its red marks are shown. */
#check-spacing[aria-pressed='true'] {
  color: #fff;
  background: #dc2626;
  border-color: #b91c1c;
}
body.theme-dark #check-spacing[aria-pressed='true'] {
  color: #fff;
  background: #b91c1c;
  border-color: #ef4444;
}

/* Use AI: the header button (an icon below 1150px, like the User Guide link), with a status dot
   while AI connections are on. */
#use-ai {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid #ffffff30;
  border-radius: 7px;
  background: #ffffff0c;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
#use-ai:hover {
  border-color: #ffffff70;
  background: #26364f;
}
#use-ai:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.use-ai-icon {
  flex: none;
  color: #ffb066;
}
.use-ai-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px #101a2f;
}
body.theme-dark .use-ai-dot {
  box-shadow: 0 0 0 2px var(--topbar-background);
}
.use-ai-dot[data-state='editing'] {
  background: #60a5fa;
  animation: ai-pulse 1.1s ease-in-out infinite;
}
.use-ai-dot[data-state='paused'] {
  background: #f59e0b;
}
.use-ai-dot[data-state='error'] {
  background: #ef4444;
}
@keyframes ai-pulse {
  50% {
    opacity: 0.35;
  }
}
/* The Use AI button needs some header room: narrower headers drop the version badge, tighten
   the layout counts and, at the narrowest, keep the ELM mark but hide the app name visually
   (as they do with a Room menu). */
@media (max-width: 1200px) {
  .brand h1 small {
    display: none;
  }
}
@media (min-width: 851px) and (max-width: 1150px) {
  .furniture-counts {
    gap: 4px;
  }
}
@media (max-width: 800px) {
  .brand h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
@media (max-width: 1150px) {
  #use-ai {
    flex: 0 0 36px;
    width: 36px;
    min-height: 36px;
    height: 36px;
    padding: 0;
  }
  .use-ai-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

/* While an AI edits: a banner over the drawing, and the locked panels and tools are dimmed. */
.ai-banner {
  position: absolute;
  z-index: calc(var(--z-canvas-tools) + 1);
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 6px 6px 6px 12px;
  border: 1px solid #8fb4ec;
  border-radius: 10px;
  background: #eef5fffa;
  color: #12305f;
  box-shadow: 0 6px 22px #101a2f30;
  font-size: 13px;
  font-weight: 700;
}
.ai-banner-text {
  min-width: 0;
  line-height: 1.35;
}
.ai-banner-mark {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1769e0;
  animation: ai-pulse 1.1s ease-in-out infinite;
}
.ai-banner button {
  flex: 0 0 auto;
  padding: 6px 11px;
}
.ai-banner[data-state='paused'] {
  border-color: #e7c06a;
  background: #fff8e6fa;
  color: #5c3b00;
}
.ai-banner[data-state='paused'] .ai-banner-mark {
  background: #f59e0b;
  animation: none;
}
.ai-banner-attention {
  animation: ai-attention 0.5s ease-in-out 2;
}
@keyframes ai-attention {
  50% {
    box-shadow: 0 0 0 4px #1769e055;
  }
}
#ai-banner .ai-banner-dismiss {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}
#ai-banner-stop,
#ai-dialog-stop {
  border-color: #b91c1c;
  background: #dc2626;
  color: #fff;
}
#ai-banner-stop:hover,
#ai-dialog-stop:hover {
  background: #b91c1c;
}
body.theme-dark .ai-banner {
  border-color: #3b6fb8;
  background: #1b2a44fa;
  color: var(--text);
}
body.theme-dark .ai-banner[data-state='paused'] {
  border-color: #a77b1f;
  background: #3a2c10fa;
  color: #fde7b0;
}
body[data-ai-editing='true'] #inventory-panel,
body[data-ai-editing='true'] #element-options-panel,
body[data-ai-editing='true'] #file-dropdown,
body[data-ai-editing='true'] .event-title-control,
body[data-ai-editing='true'] #room-switcher,
body[data-ai-editing='true'] #layout-options .toolset:first-child {
  opacity: 0.55;
}
body[data-ai-editing='true'] #canvas,
body[data-ai-editing='true'] #canvas * {
  cursor: default !important;
}
@media (prefers-reduced-motion: reduce) {
  .use-ai-dot[data-state='editing'],
  .ai-banner-mark,
  .ai-banner-attention {
    animation: none;
  }
}

/* The Use AI dialog. */
#ai-dialog {
  width: min(680px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
}
#ai-dialog button {
  float: none;
}
#ai-dialog h3 {
  margin: 20px 0 8px;
  font-size: 14px;
}
.ai-intro {
  margin: 0 0 14px;
}
.ai-notice {
  padding: 12px 14px;
  border: 1px solid #b9d0f2;
  border-radius: 10px;
  background: #eef5ff;
}
#ai-dialog .ai-notice h3 {
  margin-top: 0;
}
.ai-notice p {
  margin: 0 0 6px;
}
.ai-notice ul,
.ai-safety ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.ai-switch-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}
.ai-switch {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.ai-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}
.ai-switch-track {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  border-radius: 11px;
  background: #b4bdcb;
  transition: background 0.15s;
}
.ai-switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px #0004;
  transition: transform 0.15s;
}
.ai-switch input:checked + .ai-switch-track {
  background: #16a34a;
}
.ai-switch input:checked + .ai-switch-track::after {
  transform: translateX(16px);
}
.ai-switch input:focus-visible + .ai-switch-track {
  outline: 2px solid #1769e0;
  outline-offset: 2px;
}
.ai-switch input:disabled + .ai-switch-track {
  opacity: 0.6;
}
.ai-status-row {
  display: flex;
  flex: 1 1 240px;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
}
.ai-status-line {
  flex: 1 1 160px;
  min-width: 0;
  color: var(--muted-text);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.ai-status-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #98a2b3;
}
.ai-status-dot[data-state='on'],
.ai-status-dot[data-state='connected'] {
  background: #16a34a;
}
.ai-status-dot[data-state='editing'] {
  background: #1769e0;
  animation: ai-pulse 1.1s ease-in-out infinite;
}
.ai-status-dot[data-state='paused'] {
  background: #f59e0b;
}
.ai-status-dot[data-state='error'] {
  background: #dc2626;
}
.ai-status-row button {
  padding: 5px 10px;
}
.ai-fields {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 12px;
  margin-top: 14px;
}
.ai-fields > label {
  font-size: 12px;
  font-weight: 700;
}
.ai-copy-row {
  display: flex;
  gap: 6px;
  min-width: 0;
}
.ai-copy-row input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: Consolas, 'Cascadia Mono', Menlo, monospace;
  font-size: 12px;
}
.ai-copy-row button {
  flex: none;
}
.ai-field-hint {
  grid-column: 2;
  margin: 0;
}
#ai-dialog .ai-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
#ai-dialog .ai-tabs [role='tab'] {
  margin-bottom: -1px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  background: transparent;
  color: var(--muted-text);
}
#ai-dialog .ai-tabs [role='tab'][aria-selected='true'] {
  border-color: var(--line);
  background: var(--panel);
  color: var(--blue);
}
#ai-dialog .ai-tabs [role='tab']:hover {
  color: var(--text);
}
.ai-panel p {
  margin: 0 0 8px;
}
.ai-panel code {
  font-family: Consolas, 'Cascadia Mono', Menlo, monospace;
  font-size: 12px;
}
.ai-code {
  margin: 0 0 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font:
    12px/1.55 Consolas,
    'Cascadia Mono',
    Menlo,
    monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ai-steps {
  margin: 12px 0 0;
  padding-left: 22px;
  font-size: 13px;
  line-height: 1.6;
}
.ai-steps code,
.ai-other-apps code {
  font-family: Consolas, 'Cascadia Mono', Menlo, monospace;
  font-size: 12px;
}
.ai-other-apps {
  margin-top: 14px;
}
.ai-codex-manual {
  margin-top: 10px;
}
.ai-other-apps summary,
.ai-codex-manual summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}
.ai-other-apps p,
#ai-dialog .ai-codex-manual p {
  margin: 8px 0;
  font-size: 13px;
  line-height: 1.5;
}
.ai-update-notice {
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid #b9d0f2;
  border-radius: 8px;
  background: #eef5ff;
  font-size: 13px;
  line-height: 1.5;
}
.ai-other-apps p.hint {
  margin-bottom: 0;
  font-size: 12px;
}
.ai-prompt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}
.ai-prompt p {
  flex: 1;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}
.ai-prompt button {
  flex: none;
}
.ai-advanced {
  margin-top: 16px;
}
.ai-advanced summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}
.ai-port-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
}
.ai-port-row input {
  width: 110px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.ai-dialog-message {
  min-height: 1.6em;
  margin: 12px 0 0;
  overflow-wrap: anywhere;
}
#ai-codex-action-message:not([hidden]) {
  margin: 8px 0;
}
#ai-dialog .custom-color-actions {
  margin-top: 8px;
}
body.theme-dark .ai-notice,
body.theme-dark .ai-update-notice {
  border-color: #3b6fb8;
  background: #1b2a44;
}
body.theme-dark .ai-notice ul,
body.theme-dark .ai-safety ul,
body.theme-dark .ai-steps,
body.theme-dark .ai-other-apps p,
body.theme-dark .ai-codex-manual p {
  color: var(--footer-text);
}
body.theme-dark .ai-prompt p {
  color: var(--text);
}
body.theme-dark #ai-dialog .ai-tabs [role='tab'] {
  border-color: transparent;
  background: transparent;
  color: var(--muted-text);
}
body.theme-dark #ai-dialog .ai-tabs [role='tab'][aria-selected='true'] {
  border-color: var(--line-strong);
  background: var(--surface-raised);
  color: var(--accent-text);
}
body.theme-dark #ai-dialog .ai-tabs,
body.theme-dark .ai-switch-row,
body.theme-dark .ai-prompt {
  border-color: var(--line-strong);
}
body.theme-dark .ai-status-line {
  color: var(--footer-text);
}
body.theme-dark .ai-switch-track {
  background: #4b5870;
}
body.theme-dark .ai-code {
  background: #0b1220;
  box-shadow: inset 0 0 0 1px #2b3850;
}
@media (max-width: 560px) {
  .ai-fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .ai-field-hint {
    grid-column: 1;
  }
  .ai-copy-row {
    flex-wrap: wrap;
  }
}
/* Print layout defaults and report variants share one ordered cascade. */
@media print {
  body {
    height: auto;
    overflow: visible;
    background: white;
  }
  .topbar,
  .toolbar,
  aside,
  .inventory,
  .inspector,
  footer,
  #canvas-scrollbars-toggle,
  #empty-state {
    display: none;
  }
  main {
    display: block;
    height: auto;
  }
  .workspace,
  #canvas-wrap {
    height: 90vh;
    background: white;
  }
  .selection-overlay {
    display: none;
  }

  body {
    display: block;
  }
  main {
    display: block;
  }
  #context-menu,
  dialog {
    display: none;
  }
  #measure-context,
  #context-menu {
    display: none;
  }

  #court-context {
    display: none;
  }

  html,
  body,
  body.theme-dark,
  main,
  .workspace,
  body.theme-dark .workspace,
  #print-title,
  #print-summary {
    background: #fff !important;
    color: #000 !important;
  }
  #inline-team-editor {
    display: none;
  }
  #print-title {
    display: block;
    margin: 0 0 8pt;
    color: #000;
    font-size: 24pt;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
  }
  .workspace {
    display: block;
    height: auto;
  }
  #canvas-wrap {
    height: calc(100vh - 120pt) !important;
    flex: none;
  }
  #canvas {
    height: 100%;
  }
  #print-summary {
    display: block;
    margin-top: 8pt;
    padding-top: 6pt;
    border-top: 1pt solid #000;
    color: #000;
    break-inside: avoid;
  }
  #print-summary h2 {
    margin: 0 0 4pt;
    font-size: 11pt;
  }
  #print-summary-details {
    font-size: 10pt;
    line-height: 1.55;
  }
  #print-summary .furniture-total {
    display: inline-block;
    margin: 2pt 0;
    padding: 2pt 6pt;
    border: 1pt solid #000;
    border-radius: 3pt;
    font-size: 14pt;
    font-weight: 700;
  }
  body.print-team-report .inventory,
  body.print-team-report .workspace,
  body.print-team-report .inspector {
    display: none;
  }
  body.print-team-report #print-summary {
    display: none;
  }
  body.print-team-report #print-team-report,
  body.print-layout-and-team-report #print-team-report {
    display: block !important;
    margin: 4pt 0 0;
    color: #000;
  }
  body.print-layout-and-team-report #print-team-report {
    break-before: page;
    page-break-before: always;
  }
  body.print-team-report #print-team-report h2,
  body.print-layout-and-team-report #print-team-report h2 {
    margin: 0 0 10pt;
    font-size: 15pt;
  }
  body.print-team-report .print-roster-columns,
  body.print-layout-and-team-report .print-roster-columns {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 0;
    align-items: start;
  }
  body.print-team-report .print-roster-columns section,
  body.print-layout-and-team-report .print-roster-columns section {
    min-width: 0;
  }
  body.print-team-report .print-roster-columns section + section,
  body.print-layout-and-team-report .print-roster-columns section + section {
    border-left: 1pt solid #758096;
    padding-left: 0.18in;
  }
  body.print-team-report .print-roster-columns section:first-child,
  body.print-layout-and-team-report .print-roster-columns section:first-child {
    padding-right: 0.18in;
  }
  body.print-team-report .print-roster-columns h3,
  body.print-layout-and-team-report .print-roster-columns h3 {
    margin: 0 0 6pt;
    font-size: 10pt;
  }
  body.print-team-report .print-roster-table,
  body.print-layout-and-team-report .print-roster-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 9.5pt;
  }
  body.print-team-report .print-roster-table th,
  body.print-team-report .print-roster-table td,
  body.print-layout-and-team-report .print-roster-table th,
  body.print-layout-and-team-report .print-roster-table td {
    border: 0.5pt solid #7a8493;
    padding: 3pt 4pt;
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
  }
  body.print-team-report .print-roster-table th,
  body.print-layout-and-team-report .print-roster-table th {
    background: #edf1f6;
    font-weight: 700;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  body.print-team-report .print-roster-table thead,
  body.print-layout-and-team-report .print-roster-table thead {
    display: table-header-group;
  }
  body.print-team-report .print-roster-table tr,
  body.print-layout-and-team-report .print-roster-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  body.print-team-report .print-number-table td:nth-child(1),
  body.print-team-report .print-number-table th:nth-child(1),
  body.print-layout-and-team-report .print-number-table td:nth-child(1),
  body.print-layout-and-team-report .print-number-table th:nth-child(1) {
    width: 18%;
  }
  body.print-team-report .print-number-table td:nth-child(2),
  body.print-team-report .print-number-table th:nth-child(2),
  body.print-layout-and-team-report .print-number-table td:nth-child(2),
  body.print-layout-and-team-report .print-number-table th:nth-child(2) {
    width: 41%;
  }
  body.print-team-report .print-number-table td:nth-child(3),
  body.print-team-report .print-number-table th:nth-child(3),
  body.print-layout-and-team-report .print-number-table td:nth-child(3),
  body.print-layout-and-team-report .print-number-table th:nth-child(3) {
    width: 41%;
  }
  body.print-team-report .print-name-table td:nth-child(1),
  body.print-team-report .print-name-table th:nth-child(1),
  body.print-layout-and-team-report .print-name-table td:nth-child(1),
  body.print-layout-and-team-report .print-name-table th:nth-child(1) {
    width: 76%;
  }
  body.print-team-report .print-name-table td:nth-child(2),
  body.print-team-report .print-name-table th:nth-child(2),
  body.print-layout-and-team-report .print-name-table td:nth-child(2),
  body.print-layout-and-team-report .print-name-table th:nth-child(2) {
    width: 24%;
  }
  body.print-team-report .print-roster-table td,
  body.print-layout-and-team-report .print-roster-table td {
    overflow-wrap: anywhere;
  }
  #canvas [data-kind='door'] > path:not([data-door-opening]),
  #canvas [data-kind='double-door'] > path:not([data-double-door-opening]) {
    stroke: #111827;
  }
  #canvas [data-kind='door'] > [data-door-leaf],
  #canvas [data-kind='double-door'] > [data-double-door-leaves] {
    stroke-width: 0.24;
  }
  #canvas [data-kind='door'] > [data-door-swing],
  #canvas [data-kind='double-door'] > [data-double-door-swing] {
    stroke-width: 0.16;
  }

  #team-drag-ghost,
  #team-roster-dialog {
    display: none;
  }

  body.print-layout-no-bleachers #print-summary {
    display: none;
  }
  body.print-quantity-summary #print-summary {
    display: block !important;
  }
  body.print-layout-no-bleachers.print-quantity-summary #canvas-wrap {
    height: calc(100vh - 125pt) !important;
  }
  body.print-layout-no-bleachers #canvas-wrap {
    height: calc(100vh - 65pt) !important;
  }

  .panel-splitter {
    display: none;
  }

  .table-group-placement {
    display: none;
  }

  .room-switcher {
    display: none;
  }

  body.print-all-rooms #canvas-wrap,
  body.print-all-rooms #print-summary {
    display: none !important;
  }
  body.print-all-rooms .print-rooms {
    display: block !important;
  }
  .print-room-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 70pt);
    break-inside: avoid;
  }
  .print-room-summary {
    flex: 0 0 auto;
    margin-top: 6pt;
    padding-top: 5pt;
    border-top: 1pt solid #000;
    color: #000;
    font-size: 10pt;
    line-height: 1.4;
  }
  .print-room-page + .print-room-page {
    height: calc(100vh - 20pt);
    break-before: page;
  }
  .print-room-page h2 {
    margin: 0 0 6pt;
    color: #000;
    font-size: 16pt;
    text-align: center;
  }
  .print-room-page svg {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
  }
  .print-number-table:has(th:nth-child(4)) td:nth-child(2),
  .print-number-table:has(th:nth-child(4)) th:nth-child(2),
  .print-number-table:has(th:nth-child(4)) td:nth-child(3),
  .print-number-table:has(th:nth-child(4)) th:nth-child(3) {
    width: 30% !important;
  }
  .print-number-table:has(th:nth-child(4)) td:nth-child(4),
  .print-number-table:has(th:nth-child(4)) th:nth-child(4) {
    width: 22%;
  }

  .custom-element-menu {
    display: none;
  }

  .ai-banner {
    display: none;
  }
}

#booth-group-aisle-wrap {
  margin-top: 16px;
}
#booth-placement-dialog {
  width: min(480px, calc(100vw - 32px));
  border: 3px solid #a66b00;
  box-shadow:
    0 18px 54px #1114,
    0 0 0 3px #f5c54255;
}
#booth-placement-dialog > label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  align-items: center;
  gap: 14px;
  margin: 18px 0;
}
#booth-placement-chairs {
  width: 92px;
  justify-self: end;
}
body.theme-dark #booth-placement-dialog {
  border-color: #f5c542;
  box-shadow:
    0 18px 54px #0009,
    0 0 0 3px #f5c54255;
}

.inspector #selection-controls #booth-furniture-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 8px 12px;
  min-width: 0;
  padding: 9px 0;
}
.inspector #selection-controls #booth-furniture-options h3,
.inspector #selection-controls #booth-options-hint,
.inspector #selection-controls #booth-options-error {
  grid-column: 1 / -1;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
.inspector #selection-controls #booth-furniture-options label {
  grid-column: 1;
  min-width: 0;
  margin: 0;
}
.inspector #selection-controls #booth-table-length,
.inspector #selection-controls #booth-chair-count {
  grid-column: 2;
  width: 100%;
  min-width: 0;
}

/* The rail keeps its tabs visible and scrolls each active tool or item list inside its panel. */
#tools-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
#tools-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
#tools-list .inventory-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 56px minmax(2.5em, auto);
  align-content: start;
  justify-items: stretch;
  gap: 4px;
  min-height: 110px;
  height: 110px;
  padding: 8px 7px;
  overflow: hidden;
}
#tools-list .inventory-icon {
  display: grid;
  place-items: center;
  width: 100%;
  height: 56px;
  min-width: 0;
  min-height: 0;
  padding: 5px;
  overflow: hidden;
}
#tools-list .inventory-icon img,
#tools-list .inventory-icon svg {
  max-width: 100%;
  max-height: 100%;
}
#tools-list .inventory-copy {
  display: contents;
}
#tools-list .inventory-copy > span {
  display: -webkit-box;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: var(--font-small);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}
.element-list-tabs {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  margin: 0 0 10px;
}
.element-list-tabs button {
  flex: 1 1 0;
  min-width: 0;
  padding: 7px 4px;
  font-size: var(--font-small);
}
.element-list-tabs [aria-pressed='true'] {
  border-color: #3182f6;
  box-shadow: inset 0 -2px #3182f6;
}
#inventory-list[hidden],
#in-use-list[hidden] {
  display: none;
}
#in-use-list {
  min-height: 0;
  overflow: auto;
  padding: 0 1px 12px;
}
.in-use-type {
  border-bottom: 1px solid var(--line);
}
.in-use-type > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  list-style-position: outside;
}
.in-use-count {
  flex: 0 0 auto;
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--badge-background);
  color: var(--badge-text);
  text-align: center;
  font-size: 11px;
}
.in-use-children {
  display: grid;
  gap: 2px;
  padding: 0 0 7px 14px;
}
.in-use-item {
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 11px;
  overflow-wrap: anywhere;
}
.in-use-item:hover,
.in-use-item:focus-visible {
  border-left-color: #3182f6;
  background: var(--surface-raised);
}
.in-use-empty {
  padding: 8px 4px;
}
.in-use-hover-outline {
  pointer-events: none;
}

.in-use-type > summary::before {
  content: '▸';
  flex: 0 0 auto;
  color: var(--muted);
}
.in-use-type[open] > summary::before {
  content: '▾';
}
.in-use-count {
  margin-left: auto;
}

@media print {
  #canvas rect[fill*='grid-pattern'],
  #print-rooms rect[fill*='grid-pattern'],
  .room-draw-grid {
    display: none !important;
  }
}

#elements-panel.in-use-mode {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#elements-panel.in-use-mode .panel-heading,
#elements-panel.in-use-mode .element-list-tabs {
  flex: 0 0 auto;
}
#elements-panel.in-use-mode .rail-width-controls,
#elements-panel.in-use-mode .inventory-note {
  display: none;
}
#elements-panel.in-use-mode #in-use-list {
  flex: 1 1 auto;
}

body.theme-dark
  input:not([type='color']):not([type='checkbox']):not([type='radio']):not([type='range']):not(
    [type='file']
  ):focus,
body.theme-dark select:focus,
body.theme-dark textarea:not(#inline-annotation-text):focus {
  background: var(--field-focus-background);
  color: var(--field-text);
  border-color: var(--field-focus-border);
  box-shadow: 0 0 0 2px var(--field-focus-ring);
}

body.theme-dark
  input:not([type='color']):not([type='checkbox']):not([type='radio']):not([type='range']):not(
    [type='file']
  )::selection,
body.theme-dark textarea:not(#inline-annotation-text)::selection {
  background: #f4f7fc;
  color: #101723;
}

#assemblies-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
#assemblies-list:empty {
  display: none;
}
#assemblies-list .inventory-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--inventory-icon-height, 48px) auto;
  align-content: start;
  justify-items: stretch;
  gap: 4px;
  width: 100%;
  min-height: var(--inventory-tile-height, 110px);
  height: auto;
  padding: 7px;
  overflow: hidden;
}
#assemblies-list .inventory-icon {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
}
body.theme-dark #assemblies-list .inventory-item {
  background: var(--surface-raised);
}

#context-menu #context-create-assembly {
  grid-column: span 2;
}
#tools-list .creation-tool {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--panel-soft);
}
#tools-list .creation-tool h3,
#tools-list .creation-tool .hint {
  margin: 0;
}
#tools-list .creation-tool h3 {
  font-size: var(--font-small);
}
#tools-list .creation-tool button {
  width: 100%;
  min-height: 36px;
}

/* Transient print crop; never saved with the layout. */
.selecting-print-area #canvas,
.selecting-print-area #canvas * {
  cursor: crosshair !important;
}
#print-area-instructions {
  padding: 8px 12px;
  background: #eaf1fc;
  color: #172033;
  font-size: 12px;
}
#print-area-instructions button {
  margin-left: 12px;
}
#print-choice-dialog #select-print-area {
  float: none;
  margin-top: 8px;
}
@media print {
  #print-area-instructions {
    display: none !important;
  }
  body.print-layout #canvas {
    overflow: hidden !important;
  }
}
