:root {
  color-scheme: dark;
  --bg: #111214;
  --panel: #1d1f23;
  --panel-2: #272a30;
  --line: #3a3f47;
  --text: #f4efe6;
  --muted: #b8b0a2;
  --accent: #d5b76d;
  --accent-2: #5ab6a7;
  --danger: #e36f5d;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
summary,
.panel-heading,
.map-tools-heading {
  user-select: none;
  -webkit-user-select: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  height: 100vh;
}

.sidebar {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 18px;
  background: linear-gradient(180deg, #202227, #17191d);
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
  padding-right: 2px;
}

.brand-block h1 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin: 0;
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: #15171a;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
}

.status-pill.live {
  color: #dffaf3;
  border-color: rgba(90, 182, 167, 0.5);
  background: rgba(90, 182, 167, 0.13);
}

.profile-panel {
  border-color: rgba(90, 182, 167, 0.28);
}

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.panel {
  min-width: 0;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panels-pending .sidebar .panel > :not(h2):not(.panel-heading),
.panels-pending .sidebar .panel > .panel-heading > :not(h2) {
  display: none !important;
}

.panel-body {
  min-width: 0;
  margin-top: 12px;
}

.panel-collapse-button {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: var(--text);
  background: rgba(18, 20, 24, 0.85);
  cursor: pointer;
  transition: transform 140ms ease;
}

.panel.collapsed {
  box-shadow: none;
}

.panel.collapsed .panel-collapse-button {
  transform: rotate(-90deg);
}

.panel.shake,
.bug-report-card.shake {
  animation: panel-shake 420ms ease-in-out;
  border-color: rgba(227, 111, 93, 0.75);
}

@keyframes panel-shake {
  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-7px);
  }

  40%,
  80% {
    transform: translateX(7px);
  }
}

.filter-list,
.online-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.category-block {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px 30px 30px;
  grid-template-rows: 28px 14px;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  background: var(--panel-2);
  border: 1px solid transparent;
  border-radius: 7px;
  overflow: hidden;
}

.filter-toggle {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
  gap: 10px;
  cursor: pointer;
}

.filter-row input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  accent-color: var(--accent-2);
}

.category-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-edit-button,
.category-delete-button,
.category-expand-button {
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: var(--text);
  background: rgba(18, 20, 24, 0.85);
  cursor: pointer;
  transition: transform 140ms ease;
}

.category-edit-button {
  padding: 0;
  color: var(--muted);
  font-size: 12px;
}

.category-delete-button {
  color: #fff6f3;
  background: rgba(227, 111, 93, 0.16);
  border-color: rgba(227, 111, 93, 0.38);
}

.category-delete-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.category-expand-button.expanded {
  transform: rotate(180deg);
}

.category-entities {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 2px 8px 4px 28px;
  overflow: hidden;
}

.filter-row > .legend-order-controls {
  grid-column: 1 / -1;
  grid-row: 2;
}

.filter-row > .filter-toggle {
  grid-column: 1;
  grid-row: 1;
}

.filter-row > .category-edit-button {
  grid-column: 2;
  grid-row: 1;
}

.filter-row > .category-delete-button {
  grid-column: 3;
  grid-row: 1;
}

.filter-row > .category-expand-button {
  grid-column: 4;
  grid-row: 1;
}

.subcategory-block {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.subcategory-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  grid-template-rows: 28px 14px;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 38px;
  padding: 5px 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(38, 42, 48, 0.72);
  overflow: hidden;
}

.subcategory-row > .legend-order-controls {
  grid-column: 1 / -1;
  grid-row: 2;
}

.subcategory-row > .subcategory-name {
  grid-column: 1;
  grid-row: 1;
}

.subcategory-row > .subcategory-expand-button {
  grid-column: 2;
  grid-row: 1;
}

.subcategory-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.subcategory-expand-button {
  width: 28px;
  height: 28px;
  transition: transform 140ms ease;
}

.subcategory-expand-button.expanded {
  transform: rotate(180deg);
}

.subcategory-body {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding-left: 12px;
}

.entity-group-heading {
  margin-top: 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.entity-button {
  min-width: 0;
  width: auto;
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  padding: 5px 8px;
  color: var(--muted);
  background: rgba(18, 20, 24, 0.72);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-button:hover {
  color: var(--text);
  border-color: rgba(213, 183, 109, 0.4);
}

.entity-button.route-entity {
  color: #d9fbff;
  border-color: rgba(88, 199, 214, 0.28);
}

.empty-entities {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.2);
}

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

.marker-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.marker-form input,
.marker-form select,
.marker-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  color: var(--text);
  background: #121418;
}

.marker-form input[type="color"] {
  min-height: 42px;
  padding: 4px;
}

.tool-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.workspace-mode-toggle,
.workspace-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.auth-section {
  display: grid;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

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

.signed-in-account #emailAuthFields,
.signed-in-account #displayHandleFields,
.signed-in-account #signInActions,
.signed-in-account #createAccountActions {
  display: none !important;
}

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

.account-action-stack .primary-button,
.account-action-stack .icon-text-button {
  width: 100%;
}

.account-identity-button {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 8px 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background-color: var(--panel-2);
  background-image: linear-gradient(var(--accent), var(--accent));
  background-position: left center;
  background-repeat: no-repeat;
  background-size: 0% 100%;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.account-identity-button.email-revealed {
  animation: account-email-reveal-fill 5000ms linear forwards;
  text-shadow:
    -1px -1px 0 rgba(0, 0, 0, 0.78),
    1px -1px 0 rgba(0, 0, 0, 0.78),
    -1px 1px 0 rgba(0, 0, 0, 0.78),
    1px 1px 0 rgba(0, 0, 0, 0.78);
}

@keyframes account-email-reveal-fill {
  from { background-size: 0% 100%; }
  to { background-size: 100% 100%; }
}

.account-identity-button:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.account-identity-button:disabled {
  cursor: default;
  opacity: 0.72;
}

.account-identity-hint {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.account-identity-helper {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

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

.display-name-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.checkbox-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px !important;
}

.checkbox-row input {
  width: auto;
}

.workspace-actions .icon-text-button,
.workspace-actions .primary-button,
.workspace-actions .danger-button {
  min-width: 0;
  min-height: 36px;
  padding-inline: 8px;
}

.workspace-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.workspace-actions.account-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#inviteManagement label {
  margin-top: 8px;
  margin-bottom: 10px;
}

#inviteManagement .workspace-actions {
  margin-top: 8px;
}

.admin-controls {
  display: grid;
  gap: 10px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.admin-controls h3 {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
}

.mode-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--panel-2);
  cursor: pointer;
}

.mode-button.active {
  color: #15120b;
  border-color: var(--accent);
  background: var(--accent);
}

.mode-button:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.map-tools-overlay {
  position: absolute;
  z-index: 8;
  top: 16px;
  left: 16px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  width: min(260px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(20, 22, 25, 0.88);
  box-shadow: var(--shadow);
  cursor: move;
  touch-action: none;
  overflow: hidden;
}

.filter-row.dragging,
.subcategory-row.dragging {
  opacity: 0.55;
}

.filter-row.drag-target,
.subcategory-row.drag-target {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(213, 183, 109, 0.35);
}

.legend-order-controls {
  display: flex;
  width: 58px;
  height: 14px;
  gap: 1px;
}

.legend-order-controls[hidden],
.subcategory-body[hidden] {
  display: none;
}

.legend-drag-handle,
.legend-move-button,
.subcategory-expand-button {
  min-width: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  color: var(--muted);
  background: rgba(18, 20, 24, 0.88);
  cursor: pointer;
  line-height: 1;
  user-select: none;
}

.legend-drag-handle {
  width: 28px;
  height: 14px;
  font-size: 11px;
  cursor: grab;
}

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

.legend-move-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 28px;
  gap: 1px;
}

.legend-move-button {
  height: 13px;
  font-size: 9px;
}

.legend-drag-handle:hover,
.legend-move-button:hover,
.subcategory-expand-button:hover {
  color: var(--text);
  border-color: rgba(213, 183, 109, 0.5);
}

.legend-drag-handle:disabled,
.legend-move-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.map-tools-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.map-tools-heading h2 {
  margin: 0;
  font-size: 15px;
}

.map-tools-body {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.map-tools-overlay .mode-button {
  min-height: 36px;
  background: rgba(39, 42, 48, 0.94);
  cursor: pointer;
}

.map-tools-overlay .mode-button.active {
  color: #15120b;
  border-color: var(--accent);
  background: var(--accent);
}

.map-tools-overlay .tool-readout {
  margin-top: 0;
}

.map-tools-overlay.dragging {
  cursor: grabbing;
}

.context-tool-menu {
  position: absolute;
  z-index: 18;
  width: min(250px, calc(100% - 24px));
  max-height: min(560px, calc(100% - 24px));
  overflow: auto;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(20, 22, 25, 0.96);
  box-shadow: var(--shadow);
}

.context-tool-heading,
.context-tool-form-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.context-tool-heading h2,
.context-tool-form-heading h3 {
  margin: 0;
  font-size: 14px;
}

.context-tool-eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.context-tool-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.context-tool-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: rgba(39, 42, 48, 0.94);
  text-align: left;
  cursor: pointer;
}

.context-tool-option:hover:not(:disabled),
.context-tool-option:focus-visible {
  border-color: rgba(213, 183, 109, 0.72);
  background: rgba(54, 48, 34, 0.95);
}

.context-tool-option:focus-visible,
.context-tool-back-button:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.context-tool-option:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.context-tool-delete-option {
  border-color: rgba(227, 111, 93, 0.62);
  color: #ffd8d2;
}

.context-tool-delete-option:hover:not(:disabled),
.context-tool-delete-option:focus-visible {
  border-color: rgba(227, 111, 93, 0.9);
  background: rgba(92, 35, 31, 0.95);
}

.context-tool-option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-tool-chevron {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
}

.context-tool-back-button {
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(18, 20, 24, 0.85);
  cursor: pointer;
}

.context-tool-back-button:hover {
  color: var(--text);
  border-color: rgba(213, 183, 109, 0.5);
}

.context-marker-form {
  gap: 8px;
  margin-top: 10px;
}

.context-tool-form {
  gap: 8px;
  margin-top: 10px;
}

.context-marker-form label,
.context-tool-form label {
  gap: 4px;
  font-size: 12px;
}

.context-marker-form input,
.context-marker-form select,
.context-marker-form textarea,
.context-tool-form input,
.context-tool-form select,
.context-tool-form textarea {
  min-width: 0;
  padding: 8px;
}

.context-marker-form input[type="color"],
.context-tool-form input[type="color"] {
  min-height: 34px;
  padding: 4px;
}

.context-marker-form textarea,
.context-tool-form textarea {
  min-height: 72px;
  max-height: 180px;
  resize: vertical;
  overflow: auto;
}

.context-tool-form .tool-readout {
  margin-top: 0;
  padding: 7px 8px;
  font-size: 11px;
}

.context-tool-form .primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.context-marker-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 6px;
}

.context-marker-actions button {
  min-width: 0;
  white-space: normal;
}

.sidebar-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  min-width: 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
}

.version-readout {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.version-readout span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.donate-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(213, 183, 109, 0.48);
  border-radius: 7px;
  color: #15120b;
  background: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.tool-readout {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #121418;
  font-size: 13px;
  line-height: 1.35;
}

.wide-button {
  width: 100%;
  min-height: 36px;
  margin-top: 8px;
}

.primary-button,
.icon-text-button,
.danger-button {
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.primary-button {
  min-height: 40px;
  color: #15120b;
  background: var(--accent);
  font-weight: 800;
}

.icon-text-button {
  padding: 7px 9px;
  color: var(--text);
  background: var(--panel-2);
}

.danger-button {
  min-height: 38px;
  color: #fff6f3;
  background: rgba(227, 111, 93, 0.24);
  border: 1px solid rgba(227, 111, 93, 0.45);
}

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

.entity-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px 44px 30px;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.entity-row-no-lock {
  grid-template-columns: minmax(0, 1fr) 44px 30px;
}

.trash-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  min-width: 0;
  padding: 5px 0;
  cursor: pointer;
}

.entity-delete-button,
.entity-edit-button,
.entity-lock-button,
.trash-action-button {
  min-height: 30px;
  border: 1px solid rgba(227, 111, 93, 0.38);
  border-radius: 6px;
  color: #fff6f3;
  background: rgba(227, 111, 93, 0.16);
  cursor: pointer;
}

.entity-delete-button,
.entity-edit-button,
.entity-lock-button {
  width: 100%;
  min-width: 0;
}

.trash-action-button {
  min-width: 0;
  padding: 7px 8px;
}

.entity-edit-button {
  color: var(--text);
  border-color: rgba(213, 183, 109, 0.35);
  background: rgba(213, 183, 109, 0.14);
  font-size: 12px;
}

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

.entity-lock-button {
  color: #dffaf7;
  border-color: rgba(90, 182, 167, 0.36);
  background: rgba(90, 182, 167, 0.14);
  font-size: 12px;
}

.entity-lock-button.locked {
  color: #fff6f3;
  border-color: rgba(227, 111, 93, 0.46);
  background: rgba(227, 111, 93, 0.22);
}

.trash-bin {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.trash-group {
  display: grid;
  gap: 6px;
}

.trash-group h3 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.trash-name {
  display: block;
  min-width: 0;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trash-details {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.trash-context {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.trash-checkbox,
.trash-select-all input {
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.trash-select-all {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  cursor: pointer;
}

.trash-batch-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(213, 183, 109, 0.28);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 -6px 14px rgba(0, 0, 0, 0.28);
}

.trash-selected-count {
  color: var(--muted);
  font-size: 12px;
}

.trash-batch-buttons {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 6px;
  min-width: 0;
}

.trash-batch-buttons button {
  width: 100%;
  white-space: normal;
}

.trash-batch-result {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.user-chip {
  padding: 8px 10px;
  background: var(--panel-2);
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
}

.map-stage {
  position: relative;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  background: #0c0d0f;
}

.map-stage:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.viewer,
.marker-layer,
.route-layer {
  position: absolute;
  inset: 0;
}

.marker-layer {
  pointer-events: none;
  z-index: 4;
}

.route-layer {
  z-index: 5;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.route-layer.drawing {
  pointer-events: auto;
  cursor: crosshair;
}

.route-layer.context-hit-testing {
  pointer-events: auto;
}

.route-layer.context-hit-testing [data-map-entity-type] {
  pointer-events: visiblePainted;
}

.viewer.right-panning,
.route-layer.right-panning {
  cursor: grabbing;
}

.route-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  paint-order: stroke;
}

.saved-route {
  stroke: var(--route-color, #58c7d6);
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.55));
}

.saved-drawing {
  stroke: var(--route-color, #f2d15f);
  stroke-width: 5;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.55));
}

.draft-route {
  stroke: #f4efe6;
  stroke-dasharray: 8 8;
}

.draft-drawing {
  stroke: var(--route-color, #f2d15f);
  stroke-dasharray: 5 6;
}

.planner-route {
  stroke: #d5b76d;
  stroke-dasharray: 3 7;
}

.measure-route {
  stroke: #e36f5d;
  stroke-dasharray: 10 5;
}

.offline-conflict-ghost {
  pointer-events: none !important;
  user-select: none;
}

.offline-conflict-ghost-geometry {
  stroke: var(--route-color, var(--gold));
  stroke-dasharray: 10 7;
  opacity: 0.5;
}

.route-point.offline-conflict-ghost-point {
  opacity: 0.54;
}

.route-label.offline-conflict-ghost-label {
  opacity: 0.78;
}

.route-point {
  fill: #111214;
  stroke: #f4efe6;
  stroke-width: 2;
}

.route-label {
  fill: #f4efe6;
  stroke: rgba(0, 0, 0, 0.8);
  stroke-width: 3;
  paint-order: stroke;
  font-size: 12px;
  font-weight: 800;
}

.route-segment-note {
  fill: #f4efe6;
  stroke: rgba(0, 0, 0, 0.82);
  stroke-width: 3;
  paint-order: stroke;
  font-size: 11px;
  font-weight: 700;
}

.scale-bar {
  position: absolute;
  z-index: 9;
  left: 18px;
  bottom: 18px;
  min-width: 96px;
  padding: 8px 10px 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  color: var(--text);
  background: rgba(15, 16, 18, 0.82);
  box-shadow: var(--shadow);
  pointer-events: none;
}

.scale-line {
  height: 10px;
  border-left: 2px solid var(--text);
  border-right: 2px solid var(--text);
  border-bottom: 2px solid var(--text);
}

.scale-label {
  margin-top: 4px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.scale-bar.unavailable {
  opacity: 0.72;
}

.scale-bar.unavailable .scale-line {
  border-color: var(--muted);
}

.scale-bar.unavailable .scale-label {
  color: var(--muted);
  font-weight: 700;
}

.offline-sync-indicator {
  position: absolute;
  z-index: 10;
  left: 18px;
  bottom: 88px;
  display: grid;
  width: min(390px, calc(100% - 36px));
  padding: 8px 10px;
  border: 1px solid rgba(225, 190, 100, 0.62);
  border-radius: 7px;
  color: var(--text);
  background: rgba(15, 16, 18, 0.92);
  box-shadow: var(--shadow);
  text-align: left;
  user-select: none;
}

.offline-sync-indicator span {
  pointer-events: none;
}

#offlineSyncPrimary {
  font-size: 12px;
  font-weight: 800;
}

#offlineSyncSecondary {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.offline-sync-indicator.warning {
  border-color: #e0bd64;
  background: rgba(78, 58, 20, 0.94);
}

.offline-sync-indicator.attention {
  border-color: #df6c5d;
  background: rgba(76, 31, 27, 0.95);
}

.offline-sync-indicator.synced {
  border-color: #5ecb7a;
}

.offline-sync-panel {
  position: absolute;
  z-index: 14;
  left: 18px;
  bottom: 150px;
  width: min(430px, calc(100% - 36px));
  max-height: min(460px, calc(100% - 180px));
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  background: rgba(24, 26, 29, 0.97);
  box-shadow: var(--shadow);
}

.offline-sync-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.offline-sync-clear-controls {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-border);
}

.offline-sync-clear-controls .danger-button {
  width: 100%;
}

#offlineSyncClearStatus {
  min-height: 0;
  margin: 0;
}

#offlineSyncClearStatus:empty {
  display: none;
}

#offlineSyncClearStatus.error {
  color: var(--danger);
}

.offline-sync-item {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: rgba(11, 12, 14, 0.68);
}

.offline-sync-item-title {
  font-size: 12px;
  font-weight: 800;
}

.offline-sync-item-status {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.offline-conflict-comparison {
  display: grid;
  gap: 8px;
  padding: 9px;
  border: 1px solid rgba(225, 190, 100, 0.38);
  border-radius: 6px;
  background: rgba(225, 190, 100, 0.06);
}

.offline-conflict-comparison h3 {
  margin: 0;
  font-size: 12px;
}

.offline-conflict-entity {
  display: grid;
  gap: 3px;
  padding: 8px 9px;
  border: 1px solid rgba(225, 190, 100, 0.42);
  border-radius: 5px;
  background: rgba(225, 190, 100, 0.1);
}

.offline-conflict-entity-type {
  color: var(--gold);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.offline-conflict-entity-name {
  min-width: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

button.offline-conflict-entity-name {
  width: fit-content;
  max-width: 100%;
  padding: 2px 5px;
  border: 1px solid rgba(225, 190, 100, 0.58);
  border-radius: 4px;
  color: var(--text);
  background: rgba(9, 10, 12, 0.52);
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(225, 190, 100, 0.72);
  text-underline-offset: 2px;
}

button.offline-conflict-entity-name:hover,
button.offline-conflict-entity-name:focus-visible {
  border-color: var(--gold);
  background: rgba(225, 190, 100, 0.18);
}

.offline-conflict-summary {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.offline-conflict-metadata,
.offline-conflict-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.offline-conflict-fields {
  display: grid;
  gap: 6px;
}

.offline-conflict-field {
  display: grid;
  gap: 5px;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.offline-conflict-field-label {
  font-size: 11px;
  font-weight: 800;
}

.offline-conflict-value {
  min-width: 0;
  padding: 6px 7px;
  border-radius: 5px;
  background: rgba(9, 10, 12, 0.62);
}

.offline-conflict-value strong,
.offline-conflict-value span {
  display: block;
}

.offline-conflict-value strong {
  margin-bottom: 3px;
  color: var(--gold);
  font-size: 10px;
  text-transform: uppercase;
}

.offline-conflict-value span {
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.offline-conflict-version-focus {
  width: 100%;
  min-height: 28px;
  margin-top: 7px;
  padding: 4px 7px;
  border: 1px solid rgba(225, 190, 100, 0.42);
  border-radius: 4px;
  color: var(--text);
  background: rgba(225, 190, 100, 0.1);
  font-size: 10px;
  font-weight: 800;
}

.offline-conflict-version-focus:hover,
.offline-conflict-version-focus:focus-visible {
  border-color: var(--gold);
  background: rgba(225, 190, 100, 0.2);
}

.offline-sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.offline-sync-action {
  position: relative;
  flex: 1 1 118px;
  min-width: 0;
}

.offline-sync-actions button {
  width: 100%;
  min-height: 32px;
  padding: 5px 9px;
  font-size: 11px;
}

.offline-sync-actions button[aria-disabled="true"] {
  border-color: var(--panel-border);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.68;
}

.offline-sync-tooltip {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: calc(100% + 7px);
  display: none;
  width: max-content;
  max-width: min(250px, calc(100vw - 48px));
  margin: 0;
  padding: 7px 8px;
  border-left: 2px solid var(--gold);
  border-radius: 4px;
  transform: translateX(-50%);
  color: var(--text);
  background: rgba(9, 10, 12, 0.94);
  box-shadow: var(--shadow);
  font-size: 10px;
  line-height: 1.4;
  pointer-events: none;
}

.offline-sync-action:hover .offline-sync-tooltip,
.offline-sync-action:focus-within .offline-sync-tooltip {
  display: block;
}

@media (max-width: 560px) {
  .offline-conflict-metadata,
  .offline-conflict-values {
    grid-template-columns: minmax(0, 1fr);
  }

  .offline-sync-action {
    flex-basis: 100%;
  }
}

.update-available-notice {
  position: absolute;
  z-index: 13;
  left: 50%;
  bottom: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: min(430px, calc(100% - 32px));
  transform: translateX(-50%);
  padding: 12px;
  border: 1px solid rgba(225, 190, 100, 0.68);
  border-radius: 7px;
  color: var(--text);
  background: rgba(24, 26, 29, 0.97);
  box-shadow: var(--shadow);
}

.update-available-notice strong {
  display: block;
  font-size: 13px;
}

.update-available-notice p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.update-available-actions {
  display: flex;
  gap: 6px;
}

.update-available-actions button {
  min-height: 34px;
  padding: 6px 10px;
  white-space: nowrap;
}

.map-toolbar {
  --toolbar-wide: 150px;
  --toolbar-mid: 66px;
  --toolbar-icon: 42px;
  position: absolute;
  z-index: 8;
  top: 16px;
  right: 16px;
  display: grid;
  grid-template-columns: var(--toolbar-wide) var(--toolbar-mid) var(--toolbar-icon) var(--toolbar-mid) var(--toolbar-mid) var(--toolbar-mid);
  justify-content: end;
  align-items: center;
  max-width: calc(100% - 32px);
  gap: 8px;
}

#groupToggleButton {
  grid-column: 1;
  grid-row: 1;
}

#workspaceToggleButton {
  grid-column: 2;
  grid-row: 1;
}

#homeButton {
  grid-column: 3;
  grid-row: 1;
}

#resetButton {
  grid-column: 4;
  grid-row: 1;
}

#zoomInButton {
  grid-column: 5;
  grid-row: 1;
}

#zoomOutButton {
  grid-column: 6;
  grid-row: 1;
}

#toolbarSoloButton {
  grid-column: 5;
  grid-row: 2;
}

#toolbarGroupButton {
  grid-column: 6;
  grid-row: 2;
}

#reportBugButton {
  grid-column: 5 / 7;
  grid-row: 3;
  justify-self: stretch;
}

#settingsButton {
  grid-column: 5 / 7;
  grid-row: 4;
  justify-self: stretch;
}

.workspace-overlay,
.group-overlay {
  position: absolute;
  z-index: 10;
  top: 50%;
  left: 50%;
  right: auto;
  transform: translate(-50%, -50%);
  width: min(380px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  min-width: 0;
}

.workspace-overlay .profile-panel,
.group-overlay .profile-panel {
  background: rgba(29, 31, 35, 0.96);
  max-height: inherit;
  overflow: hidden;
}

.workspace-overlay .marker-form,
.group-overlay .marker-form {
  min-width: 0;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.workspace-overlay .panel-heading,
.group-overlay .panel-heading {
  cursor: grab;
}

.workspace-overlay.dragging .panel-heading,
.group-overlay.dragging .panel-heading {
  cursor: grabbing;
}

.group-overlay {
  width: min(560px, calc(100% - 32px));
}

.activation-modal,
.bug-report-modal,
.settings-modal {
  position: absolute;
  z-index: 16;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 7, 10, 0.52);
}

.activation-modal.hidden,
.bug-report-modal.hidden,
.settings-modal.hidden {
  display: none;
}

.activation-card,
.bug-report-card,
.settings-card {
  width: min(360px, 100%);
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(29, 31, 35, 0.98);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

.bug-report-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
}

.settings-card {
  width: min(420px, 100%);
}

.activation-card h2,
.activation-card p,
.bug-report-card h2,
.bug-report-card p,
.settings-card h2 {
  margin: 0;
}

.bug-report-card .marker-form {
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.bug-report-card .panel-heading {
  cursor: grab;
}

.bug-report-modal.dragging .panel-heading {
  cursor: grabbing;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  color: var(--text);
  background: rgba(20, 22, 25, 0.88);
  cursor: pointer;
  box-shadow: var(--shadow);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.tool-button.active,
.key-tool-button.active {
  color: #15120b;
  border-color: var(--accent);
  background: var(--accent);
}

.key-tool-button {
  font-size: 12px;
}

.group-tool-button {
  font-size: 12px;
}

.bug-tool-button {
  font-size: 12px;
}

.settings-tool-button {
  font-size: 12px;
}

.workspace-tool-button {
  font-size: 12px;
}

.advanced-details {
  display: grid;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(10, 11, 13, 0.42);
}

.advanced-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.advanced-details > summary + * {
  margin-top: 10px;
}

.advanced-details > .tool-readout + .debug-admin-block {
  margin-top: 10px;
}

.nested-details {
  margin-top: 6px;
}

.debug-admin-block {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.role-selection-label {
  margin-top: 8px;
  margin-bottom: 10px;
}

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

.group-member-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(72px, 0.45fr) minmax(96px, 0.62fr);
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  min-width: 0;
}

.group-member-row .trash-action-button,
.group-member-row .danger-button {
  min-height: 30px;
}

.permission-matrix {
  display: grid;
  gap: 8px;
}

.permission-row {
  display: grid;
  grid-template-columns: minmax(78px, 1fr) repeat(3, minmax(44px, 0.5fr)) repeat(2, minmax(74px, 0.85fr));
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(10, 11, 13, 0.38);
  min-width: 0;
}

.permission-check {
  display: grid;
  justify-items: center;
  gap: 3px;
  align-items: center;
  min-width: 0;
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  line-height: 1.1;
}

.permission-scope {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.permission-scope select {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 4px 6px;
  font-size: 11px;
}

.group-member-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.group-member-meta {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.group-member-row select,
.group-member-row button {
  min-width: 0;
  width: 100%;
}

@media (max-width: 720px) {
  .group-member-row {
    grid-template-columns: 1fr;
  }

  .permission-row {
    grid-template-columns: minmax(70px, 1fr) repeat(3, minmax(38px, 0.55fr)) repeat(2, minmax(68px, 0.9fr));
  }
}

.group-member-row.inactive {
  opacity: 0.62;
}

.identity-blocked {
  outline: 2px solid rgba(227, 111, 93, 0.8);
}

.reset-tool-button {
  font-size: 12px;
}

.viewing-counter {
  position: absolute;
  z-index: 9;
  right: 18px;
  bottom: 18px;
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  color: var(--text);
  background: rgba(15, 16, 18, 0.82);
  box-shadow: var(--shadow);
  pointer-events: none;
  font-size: 13px;
  font-weight: 800;
}

.map-marker {
  position: absolute;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%) rotate(-45deg);
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 999px 999px 999px 4px;
  pointer-events: auto;
  cursor: grab;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.map-marker::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
}

.map-marker:active {
  cursor: grabbing;
}

.map-marker.pulse {
  animation: marker-pulse 900ms ease-out;
}

.map-marker.offline-conflict-ghost-marker {
  border-style: dashed;
  cursor: default;
  opacity: 0.46;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.map-marker.offline-conflict-ghost-marker::after {
  opacity: 0.6;
}

.marker-label.offline-conflict-ghost-label {
  color: var(--gold);
  background: rgba(15, 16, 18, 0.72);
  border-color: rgba(225, 190, 100, 0.5);
  font-weight: 800;
}

@keyframes marker-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(213, 183, 109, 0.8), 0 8px 20px rgba(0, 0, 0, 0.45);
  }

  100% {
    box-shadow: 0 0 0 20px rgba(213, 183, 109, 0), 0 8px 20px rgba(0, 0, 0, 0.45);
  }
}

.map-marker.hidden {
  display: none;
}

.marker-label {
  position: absolute;
  left: 18px;
  top: -3px;
  min-width: 90px;
  max-width: 180px;
  padding: 4px 7px;
  border-radius: 6px;
  transform: rotate(45deg);
  color: var(--text);
  background: rgba(15, 16, 18, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.openseadragon-container {
  background: #0c0d0f !important;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 42vh 58vh;
  }

  .sidebar {
    height: 42vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .map-toolbar {
    --toolbar-wide: 130px;
    --toolbar-mid: 58px;
    --toolbar-icon: 38px;
    top: 8px;
    right: 8px;
    max-width: calc(100% - 16px);
    gap: 6px;
  }

  .tool-button {
    height: 36px;
    padding: 0 6px;
  }

  .group-tool-button,
  .key-tool-button,
  .reset-tool-button,
  .bug-tool-button,
  .settings-tool-button,
  .workspace-tool-button {
    font-size: 11px;
  }

  .map-stage {
    height: 58vh;
  }

  .update-available-notice {
    bottom: 48px;
    grid-template-columns: 1fr;
    width: min(360px, calc(100% - 16px));
  }

  .update-available-actions button {
    flex: 1;
  }
}
