/* Admin portal */

.admin-layout {
  display: grid;
  grid-template-columns: 226px minmax(0, 1fr) 318px;
  min-height: 730px;
  gap: 18px;
  align-items: stretch;
}

.setup-rail,
.admin-map-workspace,
.admin-inspector {
  overflow: hidden;
  border-radius: var(--radius-md);
}

@media (min-width: 1251px) {
  .admin-layout {
    height: 730px;
  }

  .setup-rail,
  .admin-map-workspace,
  .admin-inspector {
    min-height: 0;
    height: 100%;
  }
}

/* Provested Portal refinement: fixed application shell, private assigned maps, and account controls. */

.sidebar__brand {
  min-height: 76px;
}

.sidebar__brand .brand-mark {
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 9px;
}

.sidebar__nav {
  gap: 3px;
  overflow: hidden;
  padding: 9px;
  scrollbar-width: none;
}

.sidebar__nav::-webkit-scrollbar {
  display: none;
}

.sidebar__nav--platform {
  grid-template-rows: repeat(var(--nav-count), minmax(0, 1fr));
  align-content: stretch;
}

.sidebar__nav--admin {
  grid-auto-rows: 64px;
  align-content: center;
}

.sidebar__nav button {
  width: 100%;
  max-height: 64px;
  align-self: center;
  min-height: 0;
  gap: 4px;
  padding: 5px 4px;
}

.sidebar__nav svg {
  width: 32px;
  height: 32px;
  padding: 7px;
}

.sidebar__footer {
  min-height: 54px;
  padding: 8px 10px 10px;
}

.sidebar__footer button {
  padding: 6px 3px;
}

.topbar-brand strong {
  font-family: var(--font-sans);
  font-weight: 800;
  letter-spacing: -.035em;
}

.map-access-needed {
  align-self: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.assigned-maps-section {
  display: grid;
  gap: 14px;
  margin-top: 4px;
  padding-top: 8px;
}

.assigned-maps-section > .section-register {
  padding: 18px 20px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: rgba(255, 253, 249, .56);
}

.assigned-maps-section > .section-register h2 {
  margin: 3px 0 0;
  color: var(--ink);
  font: 600 27px/1.05 var(--font-sans);
  letter-spacing: -.025em;
}

.assigned-maps-section > .section-register > span {
  color: var(--teal-dark);
  font-weight: 800;
}

.assigned-map-list {
  display: grid;
  gap: 16px;
}

.assigned-map-card {
  overflow: hidden;
  border: 1px solid var(--rule-dark);
  border-radius: var(--radius-sm);
  background: var(--paper-light);
  box-shadow: 0 18px 48px rgba(20, 43, 64, .08);
}

.assigned-map-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--rule);
}

.assigned-map-card.is-collapsed > header {
  border-bottom: 0;
}

.assigned-map-card h3 {
  margin: 2px 0 0;
  color: var(--ink);
  font: 600 23px/1.1 var(--font-sans);
}

.assigned-map-card header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.assigned-map-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.assigned-map-canvas {
  position: relative;
  min-height: 320px;
  aspect-ratio: 16 / 8;
  overflow: hidden;
  background: #e5ded2;
}

.assigned-map-canvas > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.assigned-map-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.assigned-map-room {
  position: absolute;
  border: 1.5px solid rgba(19, 103, 97, .68);
  background: rgba(66, 153, 144, .09);
}

.assigned-map-device {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--teal-dark);
  box-shadow: 0 1px 5px rgba(20, 43, 64, .4);
  transform: translate(-50%, -50%);
}

.assigned-map-device--issue,
.assigned-map-device--offline {
  background: var(--ochre-dark);
}

.assigned-map-empty,
.assigned-map-pdf-note {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.console-accounts-panel {
  min-width: 0;
}

.console-account-form {
  display: grid;
  grid-template-columns: 1fr 1.25fr minmax(155px, .65fr) auto;
  gap: 10px;
  align-items: end;
  padding: 15px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-dark);
}

.console-account-form label,
.emergency-reset-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.console-account-form input,
.console-account-form select,
.emergency-reset-form input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--ink);
  border: 1px solid var(--rule-dark);
  border-radius: var(--radius-xs);
  background: var(--paper-light);
}

.console-user-row {
  grid-template-columns: auto minmax(180px, 1fr) minmax(145px, auto) auto;
}

.console-user-row.is-disabled,
.emergency-row.is-disabled {
  opacity: .62;
  background: rgba(132, 79, 63, .05);
}

.console-account-identity em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.console-account-actions,
.emergency-row__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.emergency-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.emergency-account-group + .emergency-account-group {
  border-top: 1px solid var(--rule);
}

.emergency-account-group .emergency-row {
  border-bottom: 0;
}

.emergency-reset-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 0 14px 14px 48px;
}

.emergency-reset-form > div {
  display: flex;
  gap: 8px;
}

@media (min-width: 691px) {
  body {
    height: 100dvh;
    overflow: hidden;
  }

  .app-shell {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

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

  main {
    min-height: 0;
    overflow: auto;
    padding: 22px 28px 28px;
  }

  .view-heading {
    margin-bottom: 17px;
  }
}

@media (max-width: 1250px) {
  .console-account-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .console-user-row {
    grid-template-columns: auto minmax(0, 1fr) minmax(145px, auto);
  }

  .console-account-actions {
    grid-column: 2 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 690px) {
  .assigned-map-card > header,
  .assigned-maps-section > .section-register {
    display: grid;
  }

  .assigned-map-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .assigned-map-canvas {
    min-height: 250px;
    aspect-ratio: 4 / 3;
  }

  .console-account-form,
  .console-user-row,
  .emergency-row,
  .emergency-reset-form {
    grid-template-columns: 1fr;
  }

  .console-account-actions,
  .emergency-row__actions,
  .emergency-reset-form > div {
    grid-column: auto;
    justify-content: flex-start;
  }

  .emergency-reset-form {
    padding: 0 14px 14px;
  }
}

.setup-rail {
  display: flex;
  flex-direction: column;
  background: var(--paper-light);
}

.setup-rail-heading {
  display: grid;
  gap: 2px;
  padding: 21px 18px 17px;
  border-bottom: 1px solid var(--rule);
}

.setup-rail-heading strong {
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.setup-rail-heading > span:last-child {
  color: var(--muted);
  font-size: 14px;
}

.rail-kicker {
  margin-bottom: 3px;
  color: var(--teal-dark);
}

.setup-step {
  position: relative;
  gap: 10px;
  width: 100%;
  align-items: flex-start;
  padding: 16px 14px;
  color: var(--muted);
  border: 0;
  border-bottom: 1px solid rgba(205, 191, 174, 0.7);
  background: transparent;
  text-align: left;
  transition: background 180ms ease, color 180ms ease;
}

.setup-step:hover,
.setup-step.is-active {
  color: var(--ink);
  background: var(--ochre-pale);
}

.step-number {
  display: inline-grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--ink-soft);
  border: 1px solid var(--rule-dark);
  border-radius: 50%;
  background: var(--paper-light);
  font-family: var(--font-mono);
  font-size: 14px;
}

.setup-step.is-active .step-number {
  color: var(--ink);
  border-color: var(--ochre);
  background: var(--ochre);
}

.setup-step > span:nth-child(2) {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.setup-step strong {
  color: currentColor;
  font-size: 14px;
  font-weight: 800;
}

.setup-step small {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.setup-step > svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  align-self: center;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.setup-rail-note {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: auto 15px 15px;
  padding: 12px 10px;
  color: var(--muted);
  border-top: 1px solid var(--rule);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.35;
}

.setup-rail-note svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--orange);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.admin-map-workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--paper);
}

.editor-toolbar {
  min-height: 57px;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px 0 18px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-light);
}

.editor-toolbar > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
}

.editor-toolbar > div:first-child span {
  color: var(--muted);
}

.editor-toolbar-actions {
  gap: 7px;
}

.editor-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 6px;
  color: var(--teal-dark);
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
}

.editor-mode i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
}

.admin-map-stage {
  min-height: 620px;
}

.floorplan--admin {
  inset: 6% 4% 4%;
  width: 92%;
  height: 90%;
}

.admin-map-grid {
  position: absolute;
  inset: 10% 8% 7%;
  z-index: 2;
  pointer-events: none;
  background-image: linear-gradient(rgba(42, 129, 123, 0.16) 1px, transparent 1px), linear-gradient(90deg, rgba(42, 129, 123, 0.16) 1px, transparent 1px);
  background-size: 32px 32px;
  mix-blend-mode: multiply;
  opacity: 0.28;
}

.admin-marker {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.admin-marker svg {
  transform: none;
}

.admin-marker:hover,
.admin-marker.is-selected {
  transform: translate(-50%, -50%) scale(1.13);
}

.admin-marker .map-marker-label {
  top: -24px;
  left: 22px;
  transform: none;
}

.editor-coordinates {
  position: absolute;
  right: 19px;
  bottom: 18px;
  z-index: 4;
  padding: 6px 8px;
  color: var(--teal-dark);
  border: 1px solid rgba(42, 129, 123, 0.32);
  border-radius: var(--radius-xs);
  background: rgba(251, 248, 241, 0.86);
  font-family: var(--font-mono);
  font-size: 13px;
}

.editor-controls {
  bottom: 21px;
  left: 22px;
}

.editor-help {
  position: absolute;
  top: 19px;
  right: 17px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius-xs);
  background: rgba(251, 248, 241, 0.84);
  font-size: 14px;
}

.editor-help svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--teal-dark);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.editor-footer {
  min-height: 48px;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px;
  color: var(--muted);
  border-top: 1px solid var(--rule);
  background: var(--paper-light);
  font-size: 14px;
}

.editor-footer > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-pin {
  width: 8px;
  height: 8px;
}

.admin-inspector {
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  background: var(--white);
}

.inspector-header {
  padding: 21px 19px 17px;
  border-bottom: 1px solid var(--rule);
}

.inspector-header h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.04;
}

.inspector-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.inspector-body {
  display: grid;
  gap: 18px;
  padding: 18px 19px 20px;
}

.inspector-form {
  display: grid;
  gap: 11px;
}

.field {
  display: grid;
  gap: 5px;
}

.field label,
.report-drawer label {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 800;
}

.field input,
.field select,
.report-drawer select,
.report-drawer textarea {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  color: var(--ink);
  border: 1px solid var(--rule-dark);
  border-radius: var(--radius-xs);
  outline: 0;
  background: var(--paper-light);
  font-size: 14px;
}

.field textarea,
.report-drawer textarea {
  min-height: 86px;
  padding: 10px 11px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.report-drawer select:focus,
.report-drawer textarea:focus {
  border-color: var(--teal);
  box-shadow: var(--focus);
}

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

.inspector-actions .button {
  flex: 1;
}

.inspector-note {
  display: grid;
  gap: 5px;
  padding: 12px;
  color: var(--muted);
  border: 1px dashed var(--rule);
  border-radius: var(--radius-xs);
  background: var(--paper);
  font-size: 14px;
  line-height: 1.45;
}

.inspector-note strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.07em;
}

.tab-content {
  display: grid;
  min-width: 0;
  gap: 16px;
  padding: 19px;
}

.tab-content h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.tab-content p {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.room-editor-tab {
  gap: 13px;
}

.room-editor-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
}

.room-editor-guide span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-xs);
  background: var(--paper);
}

.room-editor-guide strong {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  color: var(--paper-light);
  border-radius: 50%;
  background: var(--teal-dark);
  font-size: 13px;
}

.upload-zone {
  display: grid;
  min-height: 174px;
  place-items: center;
  gap: 10px;
  padding: 18px;
  border: 1px dashed var(--rule-dark);
  border-radius: var(--radius-sm);
  background: var(--paper);
  text-align: center;
}

.upload-zone svg {
  width: 34px;
  height: 34px;
  color: var(--teal-dark);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.45;
}

.upload-zone strong {
  color: var(--ink);
  font-size: 14px;
}

.upload-zone span {
  color: var(--muted);
  font-size: 14px;
}

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

.role-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 9px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(205, 191, 174, 0.7);
}

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

.role-avatar {
  display: inline-grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--ink);
  border-radius: 50%;
  background: var(--ochre-pale);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1;
  text-align: center;
}

.role-row strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.role-row span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.role-state {
  padding: 4px 7px;
  color: var(--teal-dark);
  border-radius: 99px;
  background: rgba(42, 129, 123, 0.12);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Drawer and feedback */

.drawer-backdrop,
.drawer-backdrop[hidden] {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: block;
  background: rgba(13, 32, 50, 0.34);
  opacity: 1;
}

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

.report-drawer,
.report-drawer[hidden] {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 21;
  display: flex;
  width: min(420px, 100vw);
  flex-direction: column;
  padding: 28px 26px;
  color: var(--text);
  border-left: 1px solid var(--rule);
  background: var(--paper-light);
  box-shadow: -18px 0 48px rgba(13, 32, 50, 0.16);
  transform: translateX(0);
}

.report-drawer[hidden] {
  display: none;
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--rule);
}

.drawer-header h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 33px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 0.96;
}

.report-drawer > p {
  max-width: 330px;
  margin: 16px 0 22px;
  color: var(--muted);
  font-size: 15px;
}

.report-drawer form {
  display: grid;
  gap: 7px;
}

.report-drawer form label:not(:first-child) {
  margin-top: 8px;
}

.report-drawer label span {
  color: var(--muted);
  font-weight: 500;
}

.report-drawer select {
  min-height: 44px;
}

.report-drawer textarea::placeholder {
  color: var(--muted-light);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  max-width: min(360px, calc(100vw - 44px));
  padding: 12px 14px;
  color: var(--paper-light);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xs);
  background: var(--ink);
  box-shadow: var(--shadow-deep);
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  transition: opacity 200ms ease, transform 220ms var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1250px) {
  .staff-layout {
    grid-template-columns: minmax(0, 1fr) 315px;
  }

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

  .admin-inspector {
    grid-column: 1 / -1;
  }

  .admin-inspector .inspector-body,
  .admin-inspector .tab-content {
    max-width: 740px;
  }
}

@media (max-width: 940px) {
  .app-shell {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .sidebar__nav {
    padding-right: 8px;
    padding-left: 8px;
  }

  .sidebar__nav button {
    min-height: 65px;
  }

  main {
    padding-right: 20px;
    padding-left: 20px;
  }

  .topbar {
    padding-right: 20px;
    padding-left: 20px;
  }

  .staff-layout {
    grid-template-columns: 1fr;
  }

  .details-panel {
    min-height: auto;
  }

  .details-panel__body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  .details-panel__footer {
    margin-top: 0;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .setup-rail {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }

  .setup-rail-heading,
  .setup-rail-note {
    display: none;
  }

  .setup-step {
    min-height: 82px;
    border-right: 1px solid var(--rule);
  }

  .setup-step:last-child {
    border-right: 0;
  }
}

@media (max-width: 690px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: block;
    height: auto;
    min-height: auto;
    align-self: auto;
    overflow: visible;
  }

  .sidebar__brand {
    display: none;
  }

  .sidebar__nav {
    display: flex;
    min-height: auto;
    flex: none;
    gap: 3px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px;
    scrollbar-width: none;
  }

  .sidebar__nav::-webkit-scrollbar {
    display: none;
  }

  .sidebar__nav button {
    min-width: 74px;
    min-height: 52px;
  }

  .sidebar__nav svg {
    width: 30px;
    height: 30px;
    padding: 6px;
  }

  .sidebar__nav span {
    font-size: 13px;
  }

  .sidebar__footer {
    display: none;
  }

  .topbar {
    min-height: 67px;
    padding: 10px 14px;
  }

  .topbar-brand strong {
    font-size: 16px;
  }

  .topbar-brand span:not(.brand-mark):not(.avatar) {
    font-size: 13px;
  }

  .brand-mark {
    width: 33px;
    height: 33px;
  }

  .topbar-actions {
    gap: 4px;
  }

  .topbar-icon,
  .icon-button {
    width: 34px;
    height: 34px;
  }

  .portal-switch {
    min-height: 32px;
    padding: 0 8px;
    font-size: 14px;
  }

  .user-name {
    display: none;
  }

  main {
    padding: 22px 12px 28px;
  }

  .map-stage {
    height: 540px;
  }

  .view-heading {
    display: grid;
    align-items: start;
    gap: 15px;
  }

  .view-heading h1 {
    font-size: 38px;
  }

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

  .map-toolbar-row {
    min-height: 51px;
    padding-left: 9px;
  }

  .map-edge-tab:nth-child(n + 2) {
    display: none;
  }

  .map-stage,
  .admin-map-stage {
    min-height: 535px;
  }

  .map-search {
    top: 15px;
    left: 15px;
    width: calc(100% - 30px);
  }

  .floorplan {
    inset: 12% -5% 8%;
    width: 110%;
    height: 83%;
  }

  .map-legend {
    right: 14px;
    bottom: 89px;
    min-width: 118px;
    padding: 8px 9px;
    font-size: 13px;
  }

  .map-note--left {
    bottom: 14px;
    left: 14px;
  }

  .map-note--right {
    display: none;
  }

  .map-controls {
    bottom: 14px;
    left: 14px;
  }

  .map-footer {
    flex-wrap: wrap;
    min-height: 62px;
    padding: 8px 12px;
  }

  .map-scale {
    display: none;
  }

  .details-panel__body {
    display: block;
  }

  .details-panel__footer {
    margin-top: 20px;
  }

  .admin-layout {
    min-height: auto;
  }

  .setup-rail {
    overflow-x: auto;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
  }

  .setup-step {
    min-width: 150px;
    padding: 12px 10px;
  }

  .admin-map-stage {
    min-height: 535px;
  }

  .floorplan--admin {
    inset: 13% -6% 7%;
    width: 112%;
    height: 82%;
  }

  .editor-help {
    right: 10px;
    max-width: 155px;
    font-size: 13px;
  }

  .editor-footer {
    flex-wrap: wrap;
    min-height: 62px;
    padding: 8px 12px;
  }

  .report-drawer {
    padding: 22px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  .auth-overlay *,
  .map-stage *,
  .admin-map-stage *,
  .toast,
  .button,
  .topbar-brand .brand-mark,
  .home-work-index button > svg:last-child {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Persistence and source-map states */

.map-source-layer {
  position: absolute;
  inset: 7% 5% 4%;
  z-index: 1;
  display: none;
  overflow: hidden;
  border: 1px solid rgba(20, 43, 64, 0.22);
  background: rgba(251, 248, 241, 0.72);
}

.admin-map-layer .map-source-layer {
  inset: 2% 2% 2%;
}

.map-layer.has-source .map-source-layer,
.admin-map-layer.has-source .map-source-layer {
  display: block;
}

.map-layer.has-source .floorplan,
.admin-map-layer.has-source .floorplan {
  opacity: 0;
  pointer-events: none;
}

.map-source-layer img,
.map-source-layer object {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
}

.map-source-layer img {
  background: var(--paper-light);
  object-fit: contain;
}

#staff-map-stage .map-source-layer,
#staff-map-layer.has-source .room-overlays,
#staff-map-layer.has-source .custom-shapes,
#staff-map-layer.has-source .map-markers {
  inset: 3% 2.5%;
}

#staff-map-layer .map-source-caption,
#staff-map-layer .map-note {
  display: none;
}

.map-source-layer object {
  background: var(--paper-light);
}

.map-source-caption {
  position: absolute;
  right: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  overflow: hidden;
  padding: 6px 8px;
  color: var(--ink-soft);
  border: 1px solid rgba(20, 43, 64, 0.18);
  border-radius: var(--radius-xs);
  background: rgba(251, 248, 241, 0.9);
  font-family: var(--font-mono);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-layer.has-source .room-overlays,
.map-layer.has-source .custom-shapes,
.map-layer.has-source .map-markers {
  inset: 7% 5% 4%;
}

.admin-map-layer.has-source .room-overlays,
.admin-map-layer.has-source .custom-shapes,
.admin-map-layer.has-source .admin-map-markers {
  inset: 2% 2% 2%;
}

.map-source-empty {
  display: grid;
  height: 100%;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.room-overlays {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.custom-shapes {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.map-shape {
  position: absolute;
  display: grid;
  place-items: center;
  min-width: 18px;
  min-height: 18px;
  padding: 0;
  color: var(--teal-dark);
  border: 1px solid rgba(29, 98, 95, 0.72);
  border-radius: 4px;
  background: rgba(42, 129, 123, 0.1);
  pointer-events: auto;
  cursor: move;
  touch-action: none;
  user-select: none;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.map-shape.is-selected,
.map-shape:hover {
  border-color: var(--ochre);
  background: rgba(231, 178, 79, 0.16);
  box-shadow: 0 0 0 3px rgba(231, 178, 79, 0.16);
}

.map-shape__icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
  pointer-events: none;
}

.map-shape--access-point,
.map-shape--camera,
.map-shape--printer,
.map-shape--server-rack,
.map-shape--laptop-trolley,
.map-shape--switch,
.map-shape--display,
.map-shape--projector,
.map-shape--tablet,
.map-shape--desktop,
.map-shape--speaker {
  color: var(--ink);
  border-color: rgba(20, 43, 64, 0.42);
  background: rgba(251, 248, 241, 0.86);
}

.shape-handle {
  position: absolute;
  z-index: 5;
  width: 11px;
  height: 11px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  background: var(--paper-light);
  pointer-events: auto;
}

.shape-handle--nw { top: -7px; left: -7px; cursor: nwse-resize; }
.shape-handle--ne { top: -7px; right: -7px; cursor: nesw-resize; }
.shape-handle--sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
.shape-handle--se { right: -7px; bottom: -7px; cursor: nwse-resize; }

.map-shape--label {
  min-width: 70px;
  justify-content: start;
  padding: 0 7px;
  color: var(--ink);
  border-style: dashed;
  background: rgba(251, 248, 241, 0.78);
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: left;
}

.map-shape--circle {
  border-radius: 50%;
  background: rgba(231, 178, 79, 0.18);
}

.map-shape--line {
  min-height: 4px;
  border: 0;
  border-radius: 999px;
  background: var(--terracotta);
}

.map-shape--pin {
  min-width: 30px;
  min-height: 30px;
  color: var(--terracotta);
  border: 0;
  background: transparent;
}

.map-shape--pin svg {
  width: 24px;
  height: 24px;
  fill: rgba(203, 104, 73, 0.15);
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.room-section {
  position: absolute;
  display: grid;
  align-content: start;
  min-width: 14px;
  min-height: 14px;
  padding: 4px;
  color: var(--teal-dark);
  border: 1px dashed rgba(29, 98, 95, 0.62);
  border-radius: 3px;
  background: rgba(231, 178, 79, 0.08);
  pointer-events: auto;
  text-align: left;
  touch-action: none;
  user-select: none;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.room-section.is-selected {
  cursor: move;
}

.room-section--candidate {
  z-index: 2;
  color: var(--ink);
  border: 2px dashed var(--ochre);
  background: rgba(231, 178, 79, 0.14);
  cursor: pointer;
  padding: 0;
}

.room-section--candidate.is-muted {
  opacity: 0.25;
  pointer-events: none;
}

.room-section__number {
  position: absolute;
  top: 3px;
  left: 3px;
  display: grid;
  width: max-content;
  min-width: 24px;
  min-height: 20px;
  place-items: center;
  color: var(--ink);
  border-radius: 3px;
  background: var(--ochre);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}

.room-handle {
  position: absolute;
  z-index: 4;
  width: 12px;
  height: 12px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  background: var(--paper-light);
  pointer-events: auto;
}

.room-handle--nw { top: -7px; left: -7px; cursor: nwse-resize; }
.room-handle--ne { top: -7px; right: -7px; cursor: nesw-resize; }
.room-handle--sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
.room-handle--se { right: -7px; bottom: -7px; cursor: nwse-resize; }

.room-draw-preview {
  position: absolute;
  z-index: 8;
  border: 2px dashed var(--teal);
  border-radius: 3px;
  background: rgba(42, 129, 123, 0.14);
  pointer-events: none;
}

.admin-map-stage.is-drawing {
  cursor: crosshair;
}

/* First-use setup: the map is the invitation, not a placeholder plan. */
.map-empty-state {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: clamp(24px, 5vw, 72px);
  background: rgba(246, 240, 227, 0.93);
}

.map-empty-state[hidden] {
  display: none !important;
}

.map-empty-state__inner {
  display: grid;
  max-width: 590px;
  justify-items: center;
  gap: 13px;
  padding: clamp(26px, 4vw, 48px);
  border: 1px solid var(--rule-dark);
  background: rgba(251, 248, 241, 0.96);
  box-shadow: 0 18px 42px rgba(20, 43, 64, 0.12);
  text-align: center;
}

.map-empty-state__mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: var(--ink);
  border: 1px solid var(--ochre);
  background: var(--ochre-pale);
}

.map-empty-state__mark svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.map-empty-state h2 {
  max-width: 16ch;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: clamp(27px, 3vw, 38px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
}

.map-empty-state p {
  max-width: 48ch;
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.6;
}

.map-empty-state__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 5px;
}

.map-empty-state__actions .button {
  min-height: 42px;
}

.map-empty-state__actions .button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.map-empty-state__hint {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.map-stage.is-empty .floorplan,
.map-stage.is-empty .map-search,
.map-stage.is-empty .map-note,
.map-stage.is-empty .map-legend,
.map-stage.is-empty .map-controls,
.map-stage.is-empty .map-markers,
.map-stage.is-empty .room-overlays,
.admin-map-stage.is-empty .floorplan,
.admin-map-stage.is-empty .admin-map-grid,
.admin-map-stage.is-empty .editor-controls,
.admin-map-stage.is-empty .editor-coordinates,
.admin-map-stage.is-empty .editor-help,
.admin-map-stage.is-empty .admin-map-markers,
.admin-map-stage.is-empty .room-overlays,
.admin-map-stage.is-empty .custom-shapes {
  visibility: hidden;
  pointer-events: none;
}

.empty-map-inspector {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 22px 19px 24px;
}

.empty-map-inspector h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.04;
}

.empty-map-inspector p {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.empty-map-inspector__steps {
  display: grid;
  gap: 1px;
  border: 1px solid var(--rule);
  background: var(--rule);
}

.empty-map-inspector__steps div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 11px;
  background: var(--paper-light);
}

.empty-map-inspector__steps strong {
  color: var(--ochre);
  font-family: var(--font-mono);
  font-size: 14px;
}

.empty-map-inspector__steps span {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.empty-map-inspector .inspector-actions {
  display: grid;
  gap: 8px;
}

.empty-map-inspector .inspector-note {
  margin-top: 2px;
}

.room-section:hover,
.room-section.is-selected {
  border-color: var(--ochre);
  background: rgba(231, 178, 79, 0.22);
  box-shadow: 0 0 0 3px rgba(231, 178, 79, 0.16);
}

.room-section:not(.is-selected):not(.room-section--candidate) .room-section__name,
.room-section:not(.is-selected):not(.room-section--candidate) .room-section__label,
.room-section:not(.is-selected):not(.room-section--candidate) .room-section__confidence {
  display: none;
}

.room-section:not(.is-selected):not(.room-section--candidate) {
  padding: 0;
  background: rgba(42, 129, 123, 0.06);
}

.room-section__name,
.room-section__label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-section__name {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.room-section__label {
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.03em;
}

.room-section__confidence {
  display: inline-flex;
  width: max-content;
  margin-top: 4px;
  padding: 2px 4px;
  color: var(--teal-dark);
  border-radius: 2px;
  background: rgba(42, 129, 123, 0.12);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.room-section--candidate .room-section__confidence {
  position: absolute;
  top: 3px;
  right: 3px;
  margin-top: 0;
  opacity: 0.78;
}

.room-section--staff {
  align-content: start;
  gap: 2px;
  padding: 5px;
  cursor: pointer;
}

.room-section--staff .room-section__name,
.room-section--staff .room-section__label {
  display: block !important;
}

.room-section--staff .room-section__name {
  max-width: calc(100% - 4px);
  padding: 2px 4px;
  border-radius: 2px;
  background: rgba(251, 248, 241, 0.88);
}

.room-section--staff .room-section__label {
  width: max-content;
  max-width: calc(100% - 4px);
  padding: 1px 4px;
  background: rgba(251, 248, 241, 0.78);
}

.room-section__device-count {
  position: absolute;
  right: 5px;
  bottom: 5px;
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  padding: 0 6px;
  color: var(--paper-light);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 3px;
  background: var(--teal-dark);
  box-shadow: 0 4px 10px rgba(20, 43, 64, 0.14);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.room-section--staff.is-empty .room-section__device-count {
  color: var(--ink-soft);
  border-color: var(--rule-dark);
  background: rgba(251, 248, 241, 0.9);
  box-shadow: none;
}

.room-section--staff.is-search-muted {
  opacity: 0.16;
}

.room-section--staff.is-search-match {
  border-style: solid;
  border-color: var(--ochre);
  background: rgba(231, 178, 79, 0.24);
  box-shadow: 0 5px 18px rgba(20, 43, 64, 0.12);
}

.room-section--staff:focus-visible {
  outline: 3px solid rgba(231, 178, 79, 0.68);
  outline-offset: 2px;
}

/* Staff map: the source drawing leads; interaction stays quiet until needed. */
.room-section--staff {
  display: block;
  padding: 0;
  border: 1.5px solid rgba(29, 98, 95, 0.48);
  border-radius: 5px;
  background: rgba(42, 129, 123, 0.045);
  box-shadow: none;
}

.room-section--staff.is-empty {
  border-color: rgba(20, 43, 64, 0.25);
  border-style: dashed;
  background: rgba(251, 248, 241, 0.025);
}

.room-section--staff:hover,
.room-section--staff.is-selected,
.room-section--staff.is-search-match {
  border-style: solid;
  border-color: var(--ochre);
  background: rgba(231, 178, 79, 0.14);
  box-shadow: 0 5px 16px rgba(20, 43, 64, 0.14);
}

.room-section__peek {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  display: none;
  min-width: 116px;
  max-width: 190px;
  padding: 8px 10px;
  color: var(--paper-light);
  border-radius: var(--radius-xs);
  background: var(--ink);
  box-shadow: 0 10px 24px rgba(13, 32, 50, 0.24);
  pointer-events: none;
  text-align: left;
  transform: translate(-50%, -50%);
}

.room-section--staff:hover .room-section__peek,
.room-section--staff:focus-visible .room-section__peek,
.room-section--staff.is-selected .room-section__peek,
.room-section--staff.is-search-match .room-section__peek {
  display: grid;
  gap: 2px;
}

.room-section__peek strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-section__peek span,
.room-section__peek small {
  overflow: hidden;
  color: rgba(251, 248, 241, 0.74);
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-section__peek small {
  margin-top: 3px;
  color: var(--ochre);
  font-family: var(--font-mono);
}

.room-section--staff .room-section__device-count {
  top: -9px;
  right: -9px;
  bottom: auto;
  display: grid;
  min-width: 22px;
  min-height: 22px;
  place-items: center;
  padding: 0 5px;
  color: var(--paper-light);
  border: 2px solid var(--paper-light);
  border-radius: 99px;
  background: var(--teal-dark);
  box-shadow: 0 4px 10px rgba(20, 43, 64, 0.18);
  font-size: 13px;
  font-weight: 700;
}

.map-legend {
  z-index: 10;
  right: 18px;
  bottom: 70px;
  border-style: solid;
  background: var(--paper-light);
  box-shadow: 0 12px 30px rgba(20, 43, 64, 0.16);
}

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

.map-edge-tab.is-active {
  color: var(--ink);
  background: var(--ochre-pale);
}

@media (max-width: 1080px) {
  .map-toolbar-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .map-search {
    top: auto;
    left: auto;
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }
}

@media (max-width: 690px) {
  .map-toolbar-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    padding: 9px;
  }

  .map-search {
    width: 100%;
  }

  .map-stage {
    height: 560px;
  }

  .details-panel {
    inset: 12px;
    width: auto;
  }

  .room-section--staff.is-selected .room-section__peek {
    display: none;
  }
}

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

.room-edit-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 30px;
  grid-template-rows: repeat(2, auto);
  gap: 7px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid rgba(205, 191, 174, 0.7);
}

.room-edit-number {
  grid-row: 1 / 3;
}

.room-edit-row input[data-room-field='name'] {
  grid-column: 2;
  grid-row: 1;
}

.room-edit-row input[data-room-field='label'] {
  grid-column: 2;
  grid-row: 2;
}

.room-edit-row .room-remove {
  grid-column: 3;
  grid-row: 1 / 3;
}

.room-edit-row.is-active {
  margin: 0 -8px;
  padding-right: 8px;
  padding-left: 8px;
  border-radius: var(--radius-xs);
  background: rgba(231, 178, 79, 0.12);
}

.room-edit-row:last-child {
  border-bottom: 0;
}

.room-edit-number {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 13px;
}

.room-edit-row input {
  width: 100%;
  min-height: 32px;
  min-width: 0;
  padding: 0 8px;
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--radius-xs);
  outline: 0;
  background: var(--paper-light);
  font-size: 14px;
}

.room-edit-row input:focus {
  border-color: var(--teal);
  box-shadow: var(--focus);
}

.room-remove {
  width: 30px;
  height: 30px;
  color: var(--terracotta);
  border-color: rgba(203, 104, 73, 0.3);
}

.room-remove:hover {
  color: var(--paper-light);
  border-color: var(--terracotta);
  background: var(--terracotta);
}

.room-remove svg {
  width: 14px;
  height: 14px;
}

.shape-palette {
  position: absolute;
  top: 62px;
  right: 17px;
  z-index: 8;
  width: min(310px, calc(100% - 34px));
  max-height: min(620px, calc(100% - 86px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(20, 43, 64, 0.34) transparent;
  scrollbar-width: thin;
  touch-action: pan-y;
  padding: 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: rgba(251, 248, 241, 0.97);
  box-shadow: 0 18px 38px rgba(20, 43, 64, 0.16);
}

.shape-palette::-webkit-scrollbar {
  width: 8px;
}

.shape-palette::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(20, 43, 64, 0.32);
  background-clip: padding-box;
}

.shape-palette-heading {
  display: grid;
  gap: 3px;
  margin-bottom: 12px;
}

.shape-palette-heading strong {
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 19px;
  font-weight: 600;
}

.shape-palette-heading > span:last-child,
.shape-palette-help {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.shape-tool-grid {
  display: grid;
  gap: 6px;
}

.shape-tool {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 9px;
  align-items: center;
  min-height: 45px;
  padding: 7px 8px;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  text-align: left;
}

.shape-tool:hover,
.shape-tool.is-active {
  border-color: rgba(42, 129, 123, 0.28);
  background: var(--teal-pale);
}

.shape-tool > span:last-child {
  display: grid;
  gap: 2px;
}

.shape-tool strong {
  font-size: 14px;
}

.shape-tool small {
  color: var(--muted);
  font-size: 13px;
}

.shape-tool-icon {
  position: relative;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--teal-dark);
  border: 1px solid rgba(42, 129, 123, 0.36);
  border-radius: 5px;
  background: rgba(42, 129, 123, 0.08);
}

.shape-tool-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.shape-palette-help {
  margin: 11px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}

.room-detection-note {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.room-detection-note svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--teal-dark);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.candidate-review,
.selected-room-editor {
  display: grid;
  gap: 12px;
  padding: 13px;
  border: 1px solid rgba(42, 129, 123, 0.28);
  border-radius: var(--radius-sm);
  background: rgba(42, 129, 123, 0.06);
}

.candidate-review {
  border-color: rgba(231, 178, 79, 0.45);
  background: rgba(231, 178, 79, 0.08);
}

.candidate-review__heading,
.selected-room-editor__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.candidate-review__heading > div,
.selected-room-editor__head > div {
  display: grid;
  gap: 3px;
}

.candidate-review__heading strong,
.selected-room-editor__head strong {
  color: var(--ink);
  font-size: 15px;
}

.candidate-review__heading span,
.selected-room-editor__devices span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.candidate-edit-list {
  display: grid;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.candidate-edit-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  grid-template-rows: repeat(2, auto);
  gap: 6px;
  align-items: center;
}

.candidate-edit-row .candidate-check {
  grid-row: 1 / 3;
}

.candidate-edit-row input[data-candidate-field='name'] {
  grid-column: 2;
  grid-row: 1;
}

.candidate-edit-row input[data-candidate-field='label'] {
  grid-column: 2;
  grid-row: 2;
}

.candidate-edit-row .room-remove {
  grid-column: 3;
  grid-row: 1 / 3;
}

.candidate-edit-row.is-muted {
  opacity: 0.4;
}

.candidate-edit-row input:not([type='checkbox']) {
  width: 100%;
  min-width: 0;
  min-height: 31px;
  padding: 0 7px;
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--radius-xs);
  background: var(--paper-light);
  font-size: 14px;
}

.candidate-check {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

.candidate-check input {
  accent-color: var(--teal);
}

.selected-room-editor .field {
  gap: 4px;
}

.selected-room-editor__devices {
  display: grid;
  gap: 3px;
  padding: 9px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-xs);
  background: rgba(251, 248, 241, 0.72);
}

.selected-room-editor__devices strong {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.room-detecting {
  color: var(--teal-dark);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.source-map-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-xs);
  background: var(--paper);
}

.source-map-card__actions {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.room-clear-detected {
  padding: 0;
  color: var(--terracotta);
  font-size: 13px;
}

.source-map-card > div:first-child {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--teal-dark);
  border-radius: var(--radius-xs);
  background: var(--ochre-pale);
}

.source-map-card svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.source-map-card strong,
.source-map-card span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.source-map-card strong {
  color: var(--ink);
  font-size: 14px;
}

.source-map-card span {
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

.source-map-card .button {
  min-height: 32px;
  padding: 0 9px;
  font-size: 14px;
}

.is-layer-hidden {
  visibility: hidden !important;
  pointer-events: none !important;
}

.panel-title-row {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-title-row > div {
  min-width: 0;
}

.map-settings-panel {
  align-content: start;
}

.settings-section {
  display: grid;
  min-width: 0;
  gap: 10px;
  padding-top: 15px;
  border-top: 1px solid var(--rule);
}

.settings-section h3,
.setting-range__heading label {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.settings-section > p {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.setting-toggle {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(205, 191, 174, 0.62);
}

.setting-toggle:last-child {
  border-bottom: 0;
}

.setting-toggle > span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.setting-toggle strong {
  color: var(--ink-soft);
  font-size: 14px;
}

.setting-toggle small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.setting-toggle input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--teal-dark);
}

.setting-range__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.setting-range__heading output {
  color: var(--teal-dark);
  font-family: var(--font-mono);
  font-size: 14px;
}

#map-zoom-range {
  width: 100%;
  accent-color: var(--teal-dark);
}

.settings-section--project .danger-text {
  justify-self: start;
  color: var(--terracotta);
}

.inspector-actions--stacked {
  display: grid;
}

.import-preview {
  display: grid;
  gap: 8px;
}

.import-preview__summary {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

.import-preview__summary strong {
  color: var(--ink);
}

.inventory-location-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px;
  color: var(--ink-soft);
  border: 1px solid var(--ochre);
  border-radius: var(--radius-xs);
  background: var(--ochre-pale);
  font-size: 14px;
  line-height: 1.45;
}

.inventory-location-note[hidden] {
  display: none;
}

.inventory-location-note svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  stroke: var(--orange);
}

.inventory-behaviour-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px;
  color: var(--ink-soft);
  border: 1px solid rgba(42, 129, 123, 0.38);
  border-radius: var(--radius-xs);
  background: rgba(42, 129, 123, 0.07);
  font-size: 14px;
  line-height: 1.45;
}

.inventory-behaviour-note svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--teal-dark);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.inventory-behaviour-note span {
  display: grid;
  gap: 2px;
}

.inventory-behaviour-note strong {
  color: var(--ink);
}

.import-assignment-list {
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius-xs);
  background: var(--paper-light);
}

.import-assignment-row {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 11px;
  border-bottom: 1px solid rgba(205, 191, 174, 0.7);
  transition: background 160ms ease;
}

.import-assignment-row:last-child {
  border-bottom: 0;
}

.import-assignment-row.is-unassigned {
  background: color-mix(in srgb, var(--ochre-pale) 45%, var(--paper-light));
}

.import-assignment-row__heading,
.import-assignment-row__meta {
  display: flex;
  gap: 8px;
  min-width: 0;
  justify-content: space-between;
  align-items: baseline;
}

.import-assignment-row__heading strong {
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.import-assignment-row__heading span {
  flex: 0 0 auto;
  color: var(--teal-dark);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.import-assignment-row.is-unassigned .import-assignment-row__heading span {
  color: var(--orange);
}

.import-assignment-row__meta {
  justify-content: flex-start;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

.import-assignment-row__meta span + span::before {
  content: '·';
  margin-inline-end: 8px;
}

.import-assignment-row label {
  display: grid;
  gap: 4px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

.import-assignment-row select {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 0 30px 0 9px;
  color: var(--ink);
  border: 1px solid var(--rule-dark);
  border-radius: var(--radius-xs);
  background: var(--paper);
  font-size: 14px;
}

.import-assignment-row.is-unassigned select {
  border-color: var(--orange);
}

.import-assignment-row select:focus {
  border-color: var(--teal);
  box-shadow: var(--focus);
}

.import-assignment-row select:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.import-pagination {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

.import-pagination > div {
  display: flex;
  gap: 5px;
}

.import-pagination button {
  min-height: 30px;
  padding: 0 9px;
  color: var(--ink-soft);
  border: 1px solid var(--rule-dark);
  border-radius: var(--radius-xs);
  background: var(--paper-light);
  font-size: 13px;
  font-weight: 800;
}

.import-pagination button:hover:not(:disabled) {
  border-color: var(--teal);
  color: var(--teal-dark);
}

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

.import-table-wrap {
  overflow: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius-xs);
}

.import-table {
  width: 100%;
  min-width: 350px;
  border-collapse: collapse;
  font-size: 13px;
}

.import-table th,
.import-table td {
  padding: 8px;
  border-bottom: 1px solid rgba(205, 191, 174, 0.7);
  text-align: left;
  vertical-align: top;
}

.import-table th {
  color: var(--muted);
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.import-table td {
  color: var(--ink);
  font-weight: 700;
}

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

.import-table .missing {
  color: var(--orange);
}

.invite-form {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-xs);
  background: var(--paper);
}

.invite-form__actions {
  display: flex;
  gap: 7px;
}

.invite-form__actions .button {
  flex: 1;
}

.role-row select {
  min-width: 76px;
  padding: 4px 5px;
  color: var(--teal-dark);
  border: 1px solid rgba(42, 129, 123, 0.2);
  border-radius: 99px;
  background: rgba(42, 129, 123, 0.12);
  font-family: var(--font-mono);
  font-size: 13px;
}

.overview-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.overview-metric {
  display: grid;
  gap: 3px;
  padding: 11px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-xs);
  background: var(--paper);
}

.overview-metric strong {
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 600;
}

.overview-metric span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.report-row {
  display: grid;
  gap: 3px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(205, 191, 174, 0.7);
}

.report-row strong {
  color: var(--ink);
  font-size: 14px;
}

.report-row span {
  color: var(--muted);
  font-size: 13px;
}

.report-row em {
  color: var(--orange);
  font-family: var(--font-mono);
  font-size: 13px;
  font-style: normal;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
