/*
  THESIS: School-map work behaves like a welcoming operations desk, not a dark command centre or a field of dashboard cards.
  OWN-WORLD: Hanken Grotesk, warm paper, white records, espresso ink, Provested yellow actions, restrained status colour, crisp mapped geometry, and 12–16px containers.
  STORY: Staff find a school or room quickly; admins move from source map to reviewed sections, assigned inventory, and explicit access without losing context.
  FIRST VIEWPORT: A calm directory or setup rail frames the largest possible map/record workspace, with the current action visibly yellow and inspectors floating only when context requires it.
  FORM: Welcoming Operations Desk, brief-pinned route layer; map transforms and renderer-owned geometry remain untouched.
*/

/* Route tokens ----------------------------------------------------------- */

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit'],
    #admin-view,
    #staff-view
  ) {
  --maps-paper: #f7f4ea;
  --maps-paper-deep: #eee9da;
  --maps-record: #ffffff;
  --maps-ink: #2b2925;
  --maps-muted: #686154;
  --maps-rule: #ddd6c5;
  --maps-rule-strong: #a9a08f;
  --maps-yellow: #ffed71;
  --maps-yellow-soft: #fff8c9;
  --maps-yellow-strong: #e4ca27;
  --maps-info: #20575d;
  --maps-info-soft: #e8f3f2;
  --maps-success: #2f6e55;
  --maps-success-soft: #e8f3ed;
  --maps-warning: #8b5c12;
  --maps-warning-soft: #fff2d4;
  --maps-danger: #a13d32;
  --maps-danger-soft: #f9e9e5;
  color: var(--maps-ink);
  font-family: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit'],
    #admin-view,
    #staff-view
  ) :where(button, input, select, textarea) {
  font-family: inherit;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit'],
    #admin-view,
    #staff-view
  ) :where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--maps-yellow-strong);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--maps-record);
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit'],
    #admin-view,
    #staff-view
  ) :where(input, select, textarea) {
  min-height: 44px;
  color: var(--maps-ink);
  border-color: var(--maps-rule-strong);
  border-radius: 12px;
  background: var(--maps-record);
  font-size: 15px;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit'],
    #admin-view,
    #staff-view
  ) :where(input, select, textarea):focus {
  border-color: var(--maps-ink);
  box-shadow: 0 0 0 3px rgba(255, 237, 113, 0.58);
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit'],
    #admin-view,
    #staff-view
  ) :where(button, input, select, textarea):disabled {
  color: #756f64;
  border-color: var(--maps-rule);
  background: var(--maps-paper-deep);
  box-shadow: none;
  opacity: 0.72;
}

/* School maps directory -------------------------------------------------- */

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) .platform-layout {
  grid-template-columns: minmax(286px, 320px) minmax(0, 1fr);
  height: clamp(620px, calc(100dvh - 238px), 780px);
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--maps-rule);
  border-radius: 16px;
  background: var(--maps-record);
  box-shadow: none;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) .platform-directory {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-right: 1px solid var(--maps-rule);
  background: var(--maps-paper);
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) .platform-directory__head {
  min-height: 108px;
  gap: 1px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--maps-rule);
  background: var(--maps-paper);
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) .platform-directory__head strong {
  color: var(--maps-ink);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) .platform-directory__head small {
  color: var(--maps-muted);
  font-size: 14px;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) .organization-list {
  align-content: start;
  max-height: none;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) .organization-row {
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 82px;
  padding: 13px 16px;
  color: var(--maps-ink);
  border-bottom: 1px solid var(--maps-rule);
  background: transparent;
  transition: color 160ms ease, background 160ms ease;
}

@media (hover: hover) {
  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit']
    ) .organization-row:hover {
    background: var(--maps-record);
    transform: none;
  }
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) .organization-row.is-active {
  background: var(--maps-yellow-soft);
  box-shadow: inset 1px 0 0 var(--maps-yellow-strong);
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) .organization-row__mark {
  width: 44px;
  height: 44px;
  color: var(--maps-ink);
  border: 1px solid var(--maps-rule);
  border-radius: 12px;
  background: var(--maps-record);
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) .organization-row.is-active .organization-row__mark {
  border-color: var(--maps-ink);
  background: var(--maps-yellow);
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) .organization-row strong {
  color: var(--maps-ink);
  font-size: 15px;
  font-weight: 750;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) .organization-row small {
  color: var(--maps-muted);
  font-size: 13px;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) .organization-row__count {
  min-width: 32px;
  padding: 5px 8px;
  color: var(--maps-ink);
  border: 1px solid var(--maps-rule);
  border-radius: 999px;
  background: var(--maps-record);
  font-family: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) .platform-inspector {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--maps-record);
}

/* Organization, access, and audit records ------------------------------- */

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) .platform-panel {
  width: 100%;
  max-width: none;
  gap: 24px;
  padding: clamp(24px, 3vw, 44px);
  background: var(--maps-record);
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) .platform-panel--empty {
  min-height: 100%;
  max-width: 620px;
  padding-block: 56px;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) .platform-panel h2 {
  max-width: 22ch;
  color: var(--maps-ink);
  font-size: clamp(30px, 3vw, 46px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.02;
  text-wrap: balance;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) .platform-panel h3 {
  color: var(--maps-ink);
  font-size: 18px;
  font-weight: 750;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) .platform-panel p {
  max-width: 70ch;
  color: var(--maps-muted);
  font-size: 15px;
  line-height: 1.55;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) :where(.organization-status, .member-status, .platform-owner-badge) {
  min-height: 30px;
  padding-inline: 10px;
  color: var(--maps-ink);
  border: 1px solid #dbc63f;
  border-radius: 999px;
  background: var(--maps-yellow-soft);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit']
  ) :where(.organization-status.is-archived, .member-status--disabled) {
  color: var(--maps-muted);
  border-color: var(--maps-rule);
  background: var(--maps-paper-deep);
}

.platform-view[data-section='organizations'] .platform-metrics {
  overflow: hidden;
  border: 1px solid var(--maps-rule);
  border-radius: 14px;
  background: var(--maps-record);
}

.platform-view[data-section='organizations'] .platform-metrics > div {
  min-height: 104px;
  padding: 18px 20px;
  border-right-color: var(--maps-rule);
  background: var(--maps-record);
}

.platform-view[data-section='organizations'] .platform-metrics strong {
  color: var(--maps-ink);
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.platform-view[data-section='organizations'] .platform-metrics span {
  color: var(--maps-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users']
  ) .platform-section {
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--maps-rule);
  border-radius: 14px;
  background: var(--maps-paper);
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users']
  ) .platform-form--compact {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users']
  ) :where(.platform-form, .invite-form) {
  gap: 14px;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users']
  ) :where(.platform-form label, .member-card__controls label > span, .account-create-form label) {
  color: var(--maps-ink);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

.platform-view[data-section='organizations'] .tenant-boundary-note,
.platform-view[data-section='platform-users'] .workspace-account-note,
#admin-view .workspace-account-note {
  gap: 10px;
  padding: 14px 16px;
  color: var(--maps-info);
  border: 1px solid #b8d4d1;
  border-radius: 12px;
  background: var(--maps-info-soft);
  font-size: 14px;
  line-height: 1.5;
}

:where(
    .platform-view[data-section='platform-users'],
    #admin-view
  ) .access-key {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--maps-rule);
  border-radius: 14px;
  background: var(--maps-record);
}

:where(
    .platform-view[data-section='platform-users'],
    #admin-view
  ) .access-key span {
  min-height: 72px;
  align-content: center;
  padding: 12px 14px;
  color: var(--maps-muted);
  border: 0;
  border-right: 1px solid var(--maps-rule);
  border-radius: 0;
  background: var(--maps-record);
  font-size: 13px;
}

:where(
    .platform-view[data-section='platform-users'],
    #admin-view
  ) .access-key span:last-child {
  border-right: 0;
}

:where(
    .platform-view[data-section='platform-users'],
    #admin-view
  ) .access-key strong {
  color: var(--maps-ink);
  font-size: 14px;
}

:where(
    .platform-view[data-section='platform-users'],
    #admin-view
  ) .member-list {
  gap: 10px;
}

:where(
    .platform-view[data-section='platform-users'],
    #admin-view
  ) .member-card {
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--maps-rule);
  border-radius: 14px;
  background: var(--maps-record);
  box-shadow: none;
}

:where(
    .platform-view[data-section='platform-users'],
    #admin-view
  ) .member-card.is-disabled {
  background: var(--maps-paper);
  opacity: 0.78;
}

:where(
    .platform-view[data-section='platform-users'],
    #admin-view
  ) .member-card__identity {
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 11px;
}

:where(
    .platform-view[data-section='platform-users'],
    #admin-view
  ) .role-avatar {
  width: 44px;
  height: 44px;
  color: var(--maps-ink);
  border: 1px solid #dbc63f;
  background: var(--maps-yellow-soft);
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
}

:where(
    .platform-view[data-section='platform-users'],
    #admin-view
  ) .member-card__identity strong {
  color: var(--maps-ink);
  font-size: 15px;
}

:where(
    .platform-view[data-section='platform-users'],
    #admin-view
  ) .member-card__identity span:not(.role-avatar):not(.member-status) {
  color: var(--maps-muted);
  font-size: 14px;
}

:where(
    .platform-view[data-section='platform-users'],
    #admin-view
  ) .member-card__actions {
  gap: 10px 16px;
  padding-top: 2px;
}

:where(
    .platform-view[data-section='platform-users'],
    #admin-view
  ) .invite-form {
  padding: 18px;
  border-color: #dbc63f;
  border-radius: 14px;
  background: var(--maps-yellow-soft);
}

/* Audit and export */

.platform-view[data-section='audit'] .audit-export-panel {
  gap: 30px;
}

.platform-view[data-section='audit'] .export-builder {
  gap: 18px;
  margin: 0;
  padding: clamp(20px, 3vw, 28px);
  color: var(--maps-ink);
  border: 1px solid #dbc63f;
  border-radius: 16px;
  background: var(--maps-yellow-soft);
  box-shadow: none;
}

.platform-view[data-section='audit'] .export-builder h2 {
  color: var(--maps-ink);
  font-size: clamp(25px, 2.4vw, 34px);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.platform-view[data-section='audit'] .export-builder p,
.platform-view[data-section='audit'] .export-builder legend,
.platform-view[data-section='audit'] .export-options > label:not(.export-archive) {
  color: var(--maps-muted);
}

.platform-view[data-section='audit'] .export-category-grid {
  gap: 8px;
}

.platform-view[data-section='audit'] :where(.export-category-grid label, .export-archive) {
  min-height: 44px;
  padding: 8px 11px;
  color: var(--maps-ink);
  border: 1px solid var(--maps-rule-strong);
  border-radius: 12px;
  background: var(--maps-record);
  font-size: 14px;
  font-weight: 650;
}

.platform-view[data-section='audit'] .export-category-grid label:has(input:checked) {
  border-color: var(--maps-ink);
  background: var(--maps-yellow);
}

.platform-view[data-section='audit'] :where(.export-category-grid input, .export-archive input) {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--maps-ink);
}

.platform-view[data-section='audit'] .export-options {
  grid-template-columns: repeat(3, minmax(130px, 1fr)) minmax(210px, 1.35fr);
  gap: 10px;
}

.platform-view[data-section='audit'] .audit-list {
  overflow: hidden;
  border: 1px solid var(--maps-rule);
  border-radius: 14px;
  background: var(--maps-record);
}

.platform-view[data-section='audit'] .audit-row {
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  padding: 16px 18px;
  border-bottom-color: var(--maps-rule);
}

.platform-view[data-section='audit'] .audit-row__mark {
  width: 44px;
  height: 44px;
  color: var(--maps-info);
  border: 1px solid #c8dedc;
  border-radius: 12px;
  background: var(--maps-info-soft);
}

.platform-view[data-section='audit'] .audit-row strong {
  color: var(--maps-ink);
  font-size: 15px;
  font-weight: 750;
}

.platform-view[data-section='audit'] .audit-row span {
  color: var(--maps-muted);
  font-size: 14px;
}

.platform-view[data-section='audit'] .audit-row small {
  color: var(--maps-muted);
  font-family: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* Admin map shell -------------------------------------------------------- */

#admin-view .admin-layout {
  grid-template-columns: 220px minmax(480px, 1fr) minmax(320px, 350px);
  height: clamp(640px, calc(100dvh - 230px), 800px);
  min-height: 640px;
  gap: 16px;
  align-items: stretch;
}

#admin-view :where(.setup-rail, .admin-map-workspace, .admin-inspector) {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--maps-rule);
  border-radius: 16px;
  background: var(--maps-record);
  box-shadow: none;
}

#admin-view .setup-rail {
  background: var(--maps-paper);
}

#admin-view .setup-rail-heading {
  gap: 2px;
  padding: 22px 18px 18px;
  border-bottom-color: var(--maps-rule);
  background: var(--maps-paper);
}

#admin-view .setup-rail-heading strong {
  color: var(--maps-ink);
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

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

#admin-view :where(.rail-kicker, .details-panel__eyebrow) {
  color: var(--maps-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

#admin-view .setup-step {
  min-height: 76px;
  gap: 11px;
  padding: 14px;
  color: var(--maps-muted);
  border-bottom-color: var(--maps-rule);
  background: transparent;
}

@media (hover: hover) {
  #admin-view .setup-step:hover {
    color: var(--maps-ink);
    background: var(--maps-record);
  }
}

#admin-view .setup-step.is-active {
  color: var(--maps-ink);
  background: var(--maps-yellow-soft);
}

#admin-view .step-number {
  width: 32px;
  height: 32px;
  color: var(--maps-ink);
  border-color: var(--maps-rule-strong);
  background: var(--maps-record);
  font-family: inherit;
  font-size: 13px;
  font-weight: 750;
}

#admin-view .setup-step.is-active .step-number {
  color: var(--maps-ink);
  border-color: var(--maps-ink);
  background: var(--maps-yellow);
}

#admin-view .setup-step strong {
  font-size: 15px;
}

#admin-view .setup-step small {
  color: var(--maps-muted);
  font-size: 13px;
}

#admin-view .setup-rail-note {
  margin: auto 14px 14px;
  padding: 14px 4px 2px;
  color: var(--maps-muted);
  border-top-color: var(--maps-rule);
  font-size: 14px;
}

#admin-view .setup-rail-note svg {
  color: var(--maps-warning);
}

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

#admin-view .editor-toolbar {
  min-height: 64px;
  padding: 8px 12px 8px 18px;
  border-bottom-color: var(--maps-rule);
  background: var(--maps-record);
}

#admin-view .editor-toolbar > div:first-child {
  color: var(--maps-ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 750;
}

#admin-view .editor-toolbar > div:first-child span {
  color: var(--maps-muted);
  font-weight: 500;
}

#admin-view .editor-mode {
  min-height: 32px;
  padding: 0 10px;
  color: var(--maps-success);
  border: 1px solid #bdd4c8;
  border-radius: 999px;
  background: var(--maps-success-soft);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  text-transform: none;
}

#admin-view .editor-mode i {
  background: var(--maps-success);
}

#admin-view :where(.editor-toolbar .icon-button, .panel-close, .room-remove) {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 12px;
}

#admin-view .editor-toolbar .icon-button.is-active {
  color: var(--maps-ink);
  border-color: var(--maps-ink);
  background: var(--maps-yellow);
}

#admin-view .admin-map-stage,
#staff-view .map-stage {
  min-height: 0;
  background-color: var(--maps-paper);
  background-image:
    linear-gradient(rgba(43, 41, 37, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(43, 41, 37, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
}

#admin-view .admin-map-stage::before,
#staff-view .map-stage::before {
  background-image: none;
}

#admin-view .admin-map-grid {
  background-image:
    linear-gradient(rgba(43, 41, 37, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(43, 41, 37, 0.1) 1px, transparent 1px);
  background-size: 32px 32px;
  mix-blend-mode: normal;
  opacity: 0.28;
}

#admin-view .map-source-layer,
#staff-view .map-source-layer {
  border-color: var(--maps-rule-strong);
  background: var(--maps-record);
}

#admin-view .map-source-caption {
  color: var(--maps-muted);
  border-color: var(--maps-rule);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  font-family: inherit;
  font-size: 12px;
  font-weight: 650;
}

#admin-view :where(.editor-coordinates, .editor-help),
#staff-view :where(.map-legend, .map-note) {
  color: var(--maps-ink);
  border: 1px solid var(--maps-rule);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.97);
}

#admin-view .editor-coordinates {
  padding: 7px 9px;
  font-family: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

#admin-view .editor-help {
  min-height: 40px;
  padding: 7px 10px;
  font-size: 13px;
}

#admin-view :where(.editor-controls, .map-controls),
#staff-view .map-controls {
  width: 46px;
  overflow: hidden;
  border-color: var(--maps-rule-strong);
  border-radius: 14px;
  background: var(--maps-record);
  box-shadow: 0 10px 24px rgba(43, 41, 37, 0.14);
}

#admin-view :where(.editor-controls, .map-controls) button,
#staff-view .map-controls button {
  width: 44px;
  height: 44px;
  min-height: 44px;
  color: var(--maps-ink);
  border-bottom-color: var(--maps-rule);
  background: var(--maps-record);
}

@media (hover: hover) {
  #admin-view :where(.editor-controls, .map-controls) button:hover,
  #staff-view .map-controls button:hover {
    color: var(--maps-ink);
    background: var(--maps-yellow);
  }
}

#admin-view .editor-footer,
#staff-view .map-footer {
  min-height: 54px;
  padding-inline: 16px;
  color: var(--maps-muted);
  border-top-color: var(--maps-rule);
  background: var(--maps-record);
  font-size: 14px;
}

/* Map geometry, markers, rooms, and shapes ------------------------------ */

:where(#admin-view, #staff-view) :where(.room-section, .map-shape)::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(100%, 44px);
  height: max(100%, 44px);
  content: '';
  transform: translate(-50%, -50%);
}

#admin-view .room-section {
  color: var(--maps-info);
  border-color: rgba(32, 87, 93, 0.72);
  border-radius: 4px;
  background: rgba(32, 87, 93, 0.08);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

#admin-view .room-section:hover,
#admin-view .room-section.is-selected {
  border-color: var(--maps-ink);
  background: rgba(255, 237, 113, 0.32);
  box-shadow: 0 0 0 3px rgba(255, 237, 113, 0.46);
}

#admin-view .room-section--candidate {
  color: var(--maps-ink);
  border: 2px dashed var(--maps-yellow-strong);
  background: rgba(255, 237, 113, 0.3);
}

#admin-view .room-section--candidate.is-muted {
  opacity: 0.32;
}

#admin-view .room-section__number {
  min-width: 26px;
  min-height: 24px;
  color: var(--maps-ink);
  border: 1px solid var(--maps-ink);
  border-radius: 6px;
  background: var(--maps-yellow);
  font-family: inherit;
  font-weight: 800;
}

#admin-view :where(.room-handle, .shape-handle) {
  width: 14px;
  height: 14px;
  border-color: var(--maps-ink);
  border-radius: 4px;
  background: var(--maps-yellow);
}

#admin-view .room-draw-preview {
  border-color: var(--maps-ink);
  background: rgba(255, 237, 113, 0.36);
}

#admin-view .map-shape {
  color: var(--maps-info);
  border-color: rgba(32, 87, 93, 0.72);
  border-radius: 6px;
  background: rgba(232, 243, 242, 0.82);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

#admin-view .map-shape:hover,
#admin-view .map-shape.is-selected {
  color: var(--maps-ink);
  border-color: var(--maps-ink);
  background: rgba(255, 237, 113, 0.56);
  box-shadow: 0 0 0 3px rgba(255, 237, 113, 0.46);
}

#admin-view :where(
    .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(--maps-ink);
  border-color: var(--maps-rule-strong);
  background: rgba(255, 255, 255, 0.94);
}

#admin-view .map-shape--circle {
  border-radius: 50%;
  background: rgba(255, 237, 113, 0.3);
}

#admin-view .map-shape--line {
  border: 0;
  background: var(--maps-ink);
}

#admin-view .map-shape--pin {
  color: var(--maps-danger);
  background: transparent;
}

#admin-view .admin-marker,
#staff-view .map-marker {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  color: var(--maps-ink);
  border: 2px solid var(--maps-record);
  background: var(--maps-success);
  box-shadow: 0 8px 20px rgba(43, 41, 37, 0.22);
}

#admin-view .admin-marker {
  border-radius: 13px;
}

#staff-view .map-marker {
  border-radius: 50% 50% 50% 8px;
}

:where(#admin-view .admin-marker, #staff-view .map-marker)[data-status='in-use'] {
  background: var(--maps-warning);
}

:where(#admin-view .admin-marker, #staff-view .map-marker)[data-status='issue'] {
  background: var(--maps-danger);
}

:where(#admin-view .admin-marker, #staff-view .map-marker)[data-status='offline'] {
  background: #716b62;
}

:where(#admin-view .admin-marker, #staff-view .map-marker):hover,
:where(#admin-view .admin-marker, #staff-view .map-marker).is-selected {
  box-shadow: 0 12px 28px rgba(43, 41, 37, 0.28), 0 0 0 5px rgba(255, 237, 113, 0.72);
  filter: none;
}

:where(#admin-view, #staff-view) .map-marker-label {
  min-height: 32px;
  padding: 6px 9px;
  color: var(--maps-ink);
  border-color: var(--maps-rule);
  border-radius: 10px;
  background: var(--maps-record);
  box-shadow: 0 10px 24px rgba(43, 41, 37, 0.18);
  font-size: 14px;
}

#staff-view .room-section--staff {
  border: 1.5px solid rgba(32, 87, 93, 0.58);
  border-radius: 5px;
  background: rgba(32, 87, 93, 0.05);
}

#staff-view .room-section--staff.is-empty {
  border-color: rgba(43, 41, 37, 0.32);
  background: rgba(255, 255, 255, 0.03);
}

#staff-view .room-section--staff:hover,
#staff-view .room-section--staff.is-selected,
#staff-view .room-section--staff.is-search-match {
  border-color: var(--maps-ink);
  background: rgba(255, 237, 113, 0.34);
  box-shadow: 0 0 0 3px rgba(255, 237, 113, 0.45);
}

#staff-view .room-section--staff .room-section__device-count {
  min-width: 26px;
  min-height: 26px;
  color: var(--maps-ink);
  border-color: var(--maps-record);
  background: var(--maps-yellow);
  box-shadow: 0 5px 12px rgba(43, 41, 37, 0.18);
  font-family: inherit;
  font-weight: 800;
}

#staff-view .room-section__peek {
  color: var(--maps-record);
  border-radius: 12px;
  background: var(--maps-ink);
  box-shadow: 0 14px 32px rgba(43, 41, 37, 0.24);
}

#staff-view .room-section__peek small {
  color: var(--maps-yellow);
  font-family: inherit;
}

/* Palettes and inspectors ------------------------------------------------ */

#admin-view .admin-inspector {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

#admin-view :where(.inspector-header, .tab-content) {
  padding: 22px;
}

#admin-view :where(.inspector-header h2, .tab-content h2, .empty-panel h2) {
  color: var(--maps-ink);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  text-wrap: balance;
}

#admin-view :where(.inspector-header p, .tab-content p, .empty-panel p) {
  color: var(--maps-muted);
  font-size: 15px;
  line-height: 1.5;
}

#admin-view .tab-content {
  gap: 16px;
}

#admin-view :where(.field label, .report-drawer label, .member-card__controls label > span) {
  color: var(--maps-ink);
  font-size: 14px;
  font-weight: 700;
}

#admin-view :where(.inspector-note, .panel-note) {
  padding: 13px 14px;
  color: var(--maps-muted);
  border: 1px solid var(--maps-rule);
  border-radius: 12px;
  background: var(--maps-paper);
  font-size: 14px;
}

#admin-view :where(.inspector-note strong, .panel-note strong) {
  color: var(--maps-ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

#admin-view .shape-palette {
  top: 72px;
  right: 16px;
  width: min(330px, calc(100% - 32px));
  max-height: min(640px, calc(100% - 92px));
  padding: 16px;
  border-color: var(--maps-rule);
  border-radius: 16px;
  background: var(--maps-record);
  box-shadow: 0 20px 48px rgba(43, 41, 37, 0.2);
}

#admin-view .shape-palette-heading strong {
  color: var(--maps-ink);
  font-size: 21px;
  font-weight: 800;
}

#admin-view :where(.shape-palette-heading > span:last-child, .shape-palette-help) {
  color: var(--maps-muted);
  font-size: 14px;
}

#admin-view .shape-tool-grid {
  gap: 6px;
}

#admin-view .shape-tool {
  grid-template-columns: 44px minmax(0, 1fr);
  min-height: 54px;
  padding: 6px 8px;
  color: var(--maps-ink);
  border: 1px solid transparent;
  border-radius: 12px;
}

@media (hover: hover) {
  #admin-view .shape-tool:hover {
    border-color: var(--maps-rule-strong);
    background: var(--maps-paper);
  }
}

#admin-view .shape-tool.is-active {
  border-color: var(--maps-ink);
  background: var(--maps-yellow);
}

#admin-view .shape-tool-icon {
  width: 44px;
  height: 44px;
  color: var(--maps-ink);
  border-color: var(--maps-rule);
  border-radius: 12px;
  background: var(--maps-record);
}

#admin-view .shape-tool.is-active .shape-tool-icon {
  border-color: var(--maps-ink);
  background: var(--maps-yellow-soft);
}

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

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

/* Room detection */

#admin-view .room-editor-guide {
  gap: 6px;
  color: var(--maps-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  text-transform: none;
}

#admin-view .room-editor-guide span {
  min-height: 36px;
  padding: 6px 9px;
  border-color: var(--maps-rule);
  border-radius: 10px;
  background: var(--maps-paper);
}

#admin-view .room-editor-guide strong {
  width: 22px;
  height: 22px;
  color: var(--maps-ink);
  border: 1px solid var(--maps-ink);
  background: var(--maps-yellow);
  font-size: 12px;
}

#admin-view .source-map-card {
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 11px;
  padding: 12px;
  border-color: var(--maps-rule);
  border-radius: 14px;
  background: var(--maps-paper);
}

#admin-view .source-map-card > div:first-child {
  width: 44px;
  height: 44px;
  color: var(--maps-ink);
  border: 1px solid #dbc63f;
  border-radius: 12px;
  background: var(--maps-yellow-soft);
}

#admin-view .source-map-card strong {
  color: var(--maps-ink);
  font-size: 15px;
}

#admin-view .source-map-card span {
  color: var(--maps-muted);
  font-family: inherit;
  font-size: 13px;
}

#admin-view :where(.candidate-review, .selected-room-editor) {
  gap: 13px;
  padding: 14px;
  border: 1px solid var(--maps-rule);
  border-radius: 14px;
  background: var(--maps-paper);
}

#admin-view .candidate-review {
  border-color: #dbc63f;
  background: var(--maps-yellow-soft);
}

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

#admin-view :where(.candidate-review__heading span, .selected-room-editor__devices span) {
  color: var(--maps-muted);
  font-size: 14px;
}

#admin-view .candidate-edit-row {
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 7px;
}

#admin-view .candidate-edit-row input:not([type='checkbox']) {
  min-height: 40px;
  border-color: var(--maps-rule-strong);
  border-radius: 10px;
  background: var(--maps-record);
}

#admin-view .candidate-check {
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
  color: var(--maps-ink);
  border: 1px solid var(--maps-rule-strong);
  border-radius: 10px;
  background: var(--maps-record);
  font-family: inherit;
  font-weight: 750;
}

#admin-view .candidate-check input,
#admin-view .setting-toggle input {
  width: 20px;
  height: 20px;
  min-height: 0;
  accent-color: var(--maps-ink);
}

#admin-view .room-detecting {
  padding: 12px 14px;
  color: var(--maps-ink);
  border: 1px solid #dbc63f;
  border-radius: 12px;
  background: var(--maps-yellow-soft);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

#admin-view .room-detecting::before {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border: 2px solid var(--maps-ink);
  border-top-color: transparent;
  border-radius: 50%;
  content: '';
  vertical-align: -1px;
  animation: maps-spin 0.9s linear infinite;
}

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

#admin-view .room-detection-note {
  color: var(--maps-muted);
  font-size: 14px;
}

#admin-view .room-detection-note svg {
  color: var(--maps-info);
}

#admin-view .room-edit-row {
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 7px;
  padding-block: 10px;
  border-bottom-color: var(--maps-rule);
}

#admin-view .room-edit-row.is-active {
  margin-inline: -8px;
  padding-inline: 8px;
  border-radius: 12px;
  background: var(--maps-yellow-soft);
}

#admin-view .room-edit-number {
  width: 44px;
  height: 44px;
  color: var(--maps-ink);
  border-color: var(--maps-rule-strong);
  border-radius: 12px;
  background: var(--maps-record);
  font-family: inherit;
  font-weight: 750;
}

#admin-view .room-edit-row.is-active .room-edit-number {
  border-color: var(--maps-ink);
  background: var(--maps-yellow);
}

#admin-view .room-edit-row input {
  min-height: 40px;
  border-color: var(--maps-rule-strong);
  border-radius: 10px;
}

#admin-view .room-remove {
  color: var(--maps-danger);
  border-color: #dfb5ad;
  background: var(--maps-danger-soft);
}

/* Inventory and map access */

#admin-view .upload-zone {
  min-height: 190px;
  gap: 10px;
  padding: 20px;
  border-color: var(--maps-rule-strong);
  border-radius: 14px;
  background: var(--maps-paper);
}

#admin-view .upload-zone svg {
  color: var(--maps-ink);
}

#admin-view .upload-zone strong {
  color: var(--maps-ink);
  font-size: 15px;
}

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

#admin-view :where(.inventory-behaviour-note, .inventory-location-note) {
  gap: 9px;
  padding: 12px 13px;
  color: var(--maps-info);
  border: 1px solid #b8d4d1;
  border-radius: 12px;
  background: var(--maps-info-soft);
  font-size: 14px;
}

#admin-view .inventory-location-note {
  color: var(--maps-warning);
  border-color: #e2c785;
  background: var(--maps-warning-soft);
}

#admin-view .inventory-behaviour-note strong {
  color: var(--maps-ink);
}

#admin-view .import-preview__summary {
  color: var(--maps-muted);
  font-family: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

#admin-view .import-preview__summary strong {
  color: var(--maps-ink);
  font-size: 14px;
}

#admin-view .import-assignment-list {
  border-color: var(--maps-rule);
  border-radius: 14px;
  background: var(--maps-record);
}

#admin-view .import-assignment-row {
  gap: 8px;
  padding: 13px;
  border-bottom-color: var(--maps-rule);
}

#admin-view .import-assignment-row.is-unassigned {
  background: var(--maps-warning-soft);
}

#admin-view .import-assignment-row__heading strong {
  color: var(--maps-ink);
  font-size: 15px;
}

#admin-view .import-assignment-row__heading span {
  color: var(--maps-success);
  font-family: inherit;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: none;
}

#admin-view .import-assignment-row.is-unassigned .import-assignment-row__heading span {
  color: var(--maps-warning);
}

#admin-view .import-assignment-row__meta {
  color: var(--maps-muted);
  font-family: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

#admin-view .import-assignment-row select {
  min-height: 44px;
  border-color: var(--maps-rule-strong);
  border-radius: 10px;
  background: var(--maps-record);
}

#admin-view .import-assignment-row.is-unassigned select {
  border-color: var(--maps-warning);
}

#admin-view .import-pagination {
  color: var(--maps-muted);
  font-family: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

#admin-view .import-pagination button {
  min-height: 44px;
  padding-inline: 12px;
  color: var(--maps-ink);
  border-color: var(--maps-rule-strong);
  border-radius: 12px;
  background: var(--maps-record);
  font-size: 14px;
}

#admin-view .import-table-wrap {
  border-color: var(--maps-rule);
  border-radius: 12px;
}

#admin-view .import-table th {
  color: var(--maps-muted);
  background: var(--maps-paper-deep);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

#admin-view .import-table td {
  color: var(--maps-ink);
  border-bottom-color: var(--maps-rule);
  font-size: 14px;
}

#admin-view .import-table .missing {
  color: var(--maps-warning);
}

/* Empty, loading, error, and floating inspection ------------------------ */

:where(#admin-view, #staff-view) .map-empty-state {
  padding: clamp(22px, 5vw, 64px);
  background: rgba(247, 244, 234, 0.95);
}

:where(#admin-view, #staff-view) .map-empty-state__inner {
  max-width: 620px;
  gap: 14px;
  padding: clamp(26px, 4vw, 44px);
  border: 1px solid var(--maps-rule);
  border-radius: 16px;
  background: var(--maps-record);
  box-shadow: none;
}

:where(#admin-view, #staff-view) .map-empty-state__mark {
  width: 56px;
  height: 56px;
  overflow: hidden;
  border: 1px solid #dbc63f;
  border-radius: 14px;
  background: var(--maps-yellow-soft);
}

:where(#admin-view, #staff-view) .map-empty-state h2 {
  color: var(--maps-ink);
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 800;
  letter-spacing: -0.035em;
}

:where(#admin-view, #staff-view) .map-empty-state p {
  color: var(--maps-muted);
  font-size: 16px;
  line-height: 1.55;
}

:where(#admin-view, #staff-view) .map-empty-state__hint {
  color: var(--maps-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit'],
    #admin-view,
    #staff-view
  ) :where(.member-empty, .empty-panel, .map-source-empty, .map-empty-search, .location-empty) {
  color: var(--maps-muted);
  border-color: var(--maps-rule-strong);
  border-radius: 14px;
  background: var(--maps-paper);
}

:where(
    .platform-view[data-section='organizations'],
    .platform-view[data-section='platform-users'],
    .platform-view[data-section='audit'],
    #admin-view,
    #staff-view
  ) :where(.form-error, [role='alert']) {
  color: var(--maps-danger);
  border: 1px solid #d8a49b;
  border-radius: 12px;
  background: var(--maps-danger-soft);
}

:where(#admin-view, #staff-view) .details-panel {
  border: 1px solid var(--maps-rule);
  border-radius: 16px;
  background: var(--maps-record);
  box-shadow: 0 22px 54px rgba(43, 41, 37, 0.22);
}

:where(#admin-view, #staff-view) .details-panel__header {
  border-bottom-color: var(--maps-rule);
}

:where(#admin-view, #staff-view) .location-device-summary {
  color: var(--maps-ink);
  border-bottom-color: var(--maps-rule);
  background: var(--maps-paper);
}

:where(#admin-view, #staff-view) .room-device-card {
  border-bottom-color: var(--maps-rule);
  background: var(--maps-record);
}

:where(#admin-view, #staff-view) .device-glyph {
  color: var(--maps-ink);
  border-color: #dbc63f;
  border-radius: 12px;
  background: var(--maps-yellow-soft);
}

/* Responsive composition ------------------------------------------------ */

@media (max-width: 1250px) {
  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit']
    ) .platform-layout {
    grid-template-columns: minmax(260px, 290px) minmax(0, 1fr);
    height: clamp(620px, calc(100dvh - 218px), 760px);
  }

  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit']
    ) .platform-panel {
    padding: 26px;
  }

  .platform-view[data-section='audit'] .export-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #admin-view .admin-layout {
    grid-template-columns: 210px minmax(0, 1fr);
    height: auto;
    min-height: 0;
  }

  #admin-view .admin-map-workspace {
    height: clamp(600px, calc(100dvh - 230px), 760px);
  }

  #admin-view .admin-inspector {
    grid-column: 1 / -1;
    height: auto;
    max-height: none;
  }

  #admin-view .admin-inspector :where(.inspector-body, .tab-content) {
    width: min(100%, 840px);
    margin-inline: auto;
  }
}

@media (max-width: 940px) {
  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit']
    ) .platform-layout {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit']
    ) .platform-directory {
    grid-template-columns: 190px minmax(0, 1fr);
    grid-template-rows: auto;
    border-right: 0;
    border-bottom: 1px solid var(--maps-rule);
  }

  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit']
    ) .platform-directory__head {
    min-height: 94px;
    border-right: 1px solid var(--maps-rule);
    border-bottom: 0;
  }

  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit']
    ) .organization-list {
    grid-auto-columns: minmax(240px, 38vw);
    grid-auto-flow: column;
    overflow-x: auto;
    overflow-y: hidden;
  }

  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit']
    ) .organization-row {
    border-right: 1px solid var(--maps-rule);
    border-bottom: 0;
  }

  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit']
    ) .platform-inspector {
    overflow: visible;
  }

  .platform-view[data-section='audit'] .export-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  #admin-view .setup-rail {
    display: grid;
    height: auto;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    overflow-x: auto;
    border-radius: 14px;
  }

  #admin-view .setup-step {
    min-height: 84px;
    border-right: 1px solid var(--maps-rule);
    border-bottom: 0;
  }

  #admin-view .admin-map-workspace {
    height: clamp(560px, calc(100dvh - 230px), 720px);
  }

  #admin-view .access-key,
  .platform-view[data-section='platform-users'] .access-key {
    grid-template-columns: 1fr;
  }

  #admin-view .access-key span,
  .platform-view[data-section='platform-users'] .access-key span {
    min-height: 58px;
    border-right: 0;
    border-bottom: 1px solid var(--maps-rule);
  }

  #admin-view .access-key span:last-child,
  .platform-view[data-section='platform-users'] .access-key span:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 690px) {
  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit']
    ) .platform-layout {
    border-radius: 14px;
  }

  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit']
    ) .platform-directory {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit']
    ) .platform-directory__head {
    min-height: 84px;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--maps-rule);
  }

  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit']
    ) .organization-list {
    grid-auto-columns: minmax(250px, 84vw);
  }

  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit']
    ) .organization-row {
    min-height: 76px;
    padding-inline: 13px;
  }

  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit']
    ) .platform-panel {
    gap: 20px;
    padding: 20px 16px 24px;
  }

  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit']
    ) .organization-title {
    display: grid;
    gap: 12px;
  }

  .platform-view[data-section='organizations'] .platform-metrics {
    grid-template-columns: 1fr;
  }

  .platform-view[data-section='organizations'] .platform-metrics > div {
    min-height: 78px;
    border-right: 0;
    border-bottom: 1px solid var(--maps-rule);
  }

  .platform-view[data-section='organizations'] .platform-metrics > div:last-child {
    border-bottom: 0;
  }

  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users']
    ) .platform-form__row,
  :where(
      .platform-view[data-section='platform-users'],
      #admin-view
    ) .member-card__controls {
    grid-template-columns: 1fr;
  }

  :where(
      .platform-view[data-section='platform-users'],
      #admin-view
    ) .member-card__identity {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  :where(
      .platform-view[data-section='platform-users'],
      #admin-view
    ) .member-card__identity .member-status {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .platform-view[data-section='audit'] .export-options {
    grid-template-columns: 1fr;
  }

  .platform-view[data-section='audit'] .export-archive {
    width: 100%;
  }

  #admin-view .admin-layout {
    gap: 12px;
  }

  #admin-view .setup-rail {
    grid-template-columns: repeat(4, minmax(146px, 1fr));
  }

  #admin-view .setup-step {
    min-width: 146px;
    min-height: 78px;
  }

  #admin-view .admin-map-workspace {
    height: auto;
    min-height: 0;
  }

  #admin-view .admin-map-stage,
  #staff-view .map-stage {
    height: clamp(440px, 62svh, 600px);
    min-height: 440px;
  }

  #admin-view .editor-toolbar {
    align-items: flex-start;
    min-height: 64px;
  }

  #admin-view .editor-toolbar > div:first-child span,
  #admin-view .editor-mode {
    display: none;
  }

  #admin-view .editor-toolbar-actions {
    margin-left: auto;
  }

  #admin-view .editor-help {
    display: none;
  }

  #admin-view .shape-palette {
    top: 66px;
    right: 10px;
    width: calc(100% - 20px);
    max-height: calc(100% - 78px);
  }

  #admin-view :where(.inspector-header, .tab-content) {
    padding: 20px 16px;
  }

  #admin-view .source-map-card {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  #admin-view .source-map-card__actions,
  #admin-view .source-map-card > .button {
    grid-column: 1 / -1;
    width: 100%;
    justify-items: stretch;
  }

  #admin-view .source-map-card__actions .button {
    width: 100%;
  }

  #admin-view .candidate-review__heading,
  #admin-view .selected-room-editor__head,
  #admin-view .import-assignment-row__heading,
  #admin-view .import-assignment-row__meta,
  #admin-view .import-pagination {
    align-items: flex-start;
    flex-direction: column;
  }

  #admin-view .candidate-edit-row,
  #admin-view .room-edit-row {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }

  #admin-view .map-empty-state__actions,
  #staff-view .map-empty-state__actions {
    display: grid;
    width: 100%;
  }

  #admin-view .map-empty-state__actions .button,
  #staff-view .map-empty-state__actions .button {
    width: 100%;
  }

  :where(#admin-view, #staff-view) .details-panel {
    inset: 10px;
    width: auto;
    border-radius: 14px;
  }
}

/* Contrast and motion preferences --------------------------------------- */

@media (prefers-contrast: more) {
  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit'],
      #admin-view,
      #staff-view
    ) {
    --maps-muted: #4d483f;
    --maps-rule: #8a8274;
    --maps-rule-strong: #514c43;
  }

  #admin-view .room-section,
  #staff-view .room-section--staff {
    border-width: 2px;
  }
}

@media (forced-colors: active) {
  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit'],
      #admin-view,
      #staff-view
    ) :where(button, input, select, textarea, .platform-layout, .admin-map-workspace, .admin-inspector, .setup-rail) {
    border: 1px solid CanvasText;
  }

  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit'],
      #admin-view,
      #staff-view
    ) :where(.is-active, .is-selected, :checked) {
    forced-color-adjust: none;
    color: #000000;
    background: #ffff00;
  }
}

@media (prefers-reduced-motion: reduce) {
  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit'],
      #admin-view,
      #staff-view
    ) *,
  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit'],
      #admin-view,
      #staff-view
    ) *::before,
  :where(
      .platform-view[data-section='organizations'],
      .platform-view[data-section='platform-users'],
      .platform-view[data-section='audit'],
      #admin-view,
      #staff-view
    ) *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* School Maps product rebuild ------------------------------------------- */

.platform-view[data-section='organizations'] .platform-layout.is-wide {
  display: block;
  height: auto;
  min-height: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.platform-view[data-section='organizations'] .platform-inspector--wide {
  overflow: visible;
  background: transparent;
}

.maps-dashboard {
  position: relative;
  display: grid;
  gap: 32px;
  color: var(--maps-ink);
}

.maps-register {
  display: grid;
  grid-template-columns: repeat(3, minmax(128px, 180px)) minmax(260px, 1fr);
  min-height: 90px;
  overflow: hidden;
  border: 1px solid var(--maps-rule);
  border-radius: 16px;
  background: var(--maps-record);
}

.maps-register > div,
.maps-register > p {
  display: grid;
  align-content: center;
  min-width: 0;
  margin: 0;
  padding: 18px 22px;
  border-right: 1px solid var(--maps-rule);
}

.maps-register > div strong {
  color: var(--maps-ink);
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
}

.maps-register > div span,
.maps-register > p {
  color: var(--maps-muted);
  font-size: 14px;
  line-height: 1.45;
}

.maps-register > p {
  border-right: 0;
  background: var(--maps-paper);
}

.maps-recent,
.maps-library {
  display: grid;
  gap: 16px;
}

.maps-recent > header,
.maps-library > header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.maps-recent h2,
.maps-library h2,
.map-create-wizard h2,
.map-quick-panel h2,
.map-preview-dialog h2 {
  margin: 0;
  color: var(--maps-ink);
  font-size: 29px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.maps-recent header p,
.maps-library header p,
.map-create-wizard header p,
.map-quick-panel header p,
.map-preview-dialog__header p {
  margin: 5px 0 0;
  color: var(--maps-muted);
  font-size: 15px;
  line-height: 1.5;
}

.maps-recent > div {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.maps-recent > div > button {
  display: grid;
  min-width: 0;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  padding: 8px;
  color: var(--maps-ink);
  border: 1px solid var(--maps-rule);
  border-radius: 14px;
  background: var(--maps-record);
  text-align: left;
  transition: border-color 180ms var(--ease-standard), transform 180ms var(--ease-standard), box-shadow 180ms var(--ease-standard);
}

.maps-recent > div > button strong,
.maps-recent > div > button small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.maps-recent > div > button strong {
  font-size: 15px;
  font-weight: 750;
}

.maps-recent > div > button small {
  margin-top: 3px;
  color: var(--maps-muted);
  font-size: 13px;
}

@media (hover: hover) {
  .maps-recent > div > button:hover,
  .map-gallery-card:hover {
    border-color: var(--maps-rule-strong);
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(43, 41, 37, 0.09), 0 2px 6px rgba(43, 41, 37, 0.05);
  }
}

.maps-library-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.maps-library-controls select,
.maps-search {
  min-height: 46px;
  border: 1px solid var(--maps-rule-strong);
  border-radius: 12px;
  background: var(--maps-record);
}

.maps-search {
  display: grid;
  width: min(330px, 32vw);
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 13px;
}

.maps-search svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--maps-muted);
  stroke-width: 1.8;
}

.maps-search input {
  min-height: 42px !important;
  padding: 0;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.map-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(270px, 1fr));
  gap: 18px;
}

.map-gallery-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--maps-rule);
  border-radius: 16px;
  background: var(--maps-record);
  transition: border-color 180ms var(--ease-standard), transform 180ms var(--ease-standard), box-shadow 180ms var(--ease-standard);
  animation: map-card-arrive 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.map-gallery-card:nth-child(2) { animation-delay: 35ms; }
.map-gallery-card:nth-child(3) { animation-delay: 70ms; }
.map-gallery-card:nth-child(4) { animation-delay: 105ms; }
.map-gallery-card:nth-child(n + 5) { animation-delay: 140ms; }

@keyframes map-card-arrive {
  from { opacity: 0.72; transform: translateY(10px); filter: blur(2px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.map-gallery-card.is-archived {
  opacity: 0.72;
}

.map-gallery-card__preview {
  position: relative;
  height: 188px;
  overflow: hidden;
  border-bottom: 1px solid var(--maps-rule);
  background: var(--maps-paper-deep);
}

.map-card-thumbnail {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--maps-paper-deep);
}

.map-card-thumbnail.is-compact {
  width: 92px;
  height: 64px;
  border-radius: 10px;
}

.map-card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.map-card-room {
  position: absolute;
  z-index: 1;
  border: 1px solid rgba(32, 87, 93, 0.62);
  background: rgba(232, 243, 242, 0.24);
}

.map-card-thumbnail__veil {
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  height: 44%;
  background: linear-gradient(to bottom, transparent, rgba(43, 41, 37, 0.18));
}

.map-card-thumbnail--empty {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  color: var(--maps-muted);
  background: var(--maps-paper);
}

.map-card-thumbnail--empty > span {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--maps-rule);
  border-radius: 12px;
  background: var(--maps-record);
}

.map-card-thumbnail--empty svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.map-card-thumbnail--empty strong { color: var(--maps-ink); font-size: 14px; }
.map-card-thumbnail--empty small { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; }

.map-publication-status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  width: max-content;
  padding: 0 10px;
  border: 1px solid var(--maps-rule-strong);
  border-radius: 999px;
  color: var(--maps-ink);
  background: var(--maps-record);
  font-size: 13px;
  font-weight: 750;
}

.map-gallery-card__preview > .map-publication-status {
  position: absolute;
  z-index: 4;
  top: 12px;
  left: 12px;
}

.map-publication-status.is-published { color: var(--maps-success); border-color: #a8caba; background: var(--maps-success-soft); }
.map-publication-status.is-draft { color: var(--maps-warning); border-color: #d9bd7e; background: var(--maps-warning-soft); }
.map-publication-status.is-setup { color: var(--maps-info); border-color: #b8d4d2; background: var(--maps-info-soft); }
.map-publication-status.is-archived { color: var(--maps-muted); background: var(--maps-paper-deep); }

.map-gallery-card__body {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.map-gallery-card__title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.map-gallery-card__title h3 {
  margin: 0;
  color: var(--maps-ink);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.map-gallery-card__title p {
  display: -webkit-box;
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--maps-muted);
  font-size: 14px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.map-gallery-card__title > span {
  flex: none;
  padding: 4px 7px;
  color: var(--maps-muted);
  border-radius: 8px;
  background: var(--maps-paper);
  font-size: 12px;
  font-weight: 800;
}

.map-gallery-card__meta {
  display: grid;
  gap: 7px;
  margin: 0;
}

.map-gallery-card__meta > div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
}

.map-gallery-card__meta dt,
.map-gallery-card__meta dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
}

.map-gallery-card__meta dt { color: var(--maps-muted); }
.map-gallery-card__meta dd { overflow: hidden; color: var(--maps-ink); font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }

.map-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
}

.map-card-actions .button { min-height: 40px; padding-inline: 14px; }

.map-card-more {
  display: flex;
  flex: 1 0 100%;
  gap: 14px;
  padding-top: 8px;
  border-top: 1px solid var(--maps-rule);
}

.map-card-more .text-button { min-height: 32px; }

.maps-empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  place-content: center;
  gap: 8px;
  grid-column: 1 / -1;
  padding: 32px;
  border: 1px dashed var(--maps-rule-strong);
  border-radius: 16px;
  background: var(--maps-paper);
  text-align: center;
}

.maps-empty-state h3 { margin: 0; font-size: 22px; }
.maps-empty-state p { max-width: 46ch; margin: 0 0 8px; color: var(--maps-muted); }

/* Progressive creation */

.map-create-wizard {
  display: grid;
  gap: 22px;
  padding: clamp(22px, 3vw, 34px);
  border: 1px solid #d9c745;
  border-radius: 16px;
  background: var(--maps-yellow-soft);
}

.map-create-wizard > header,
.map-quick-panel > header,
.map-preview-dialog__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}

.map-create-wizard > header span,
.map-quick-panel > header span,
.map-preview-dialog__header > div > span {
  display: block;
  margin-bottom: 5px;
  color: var(--maps-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.map-create-wizard > nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid rgba(43, 41, 37, 0.18);
}

.map-create-wizard > nav > span {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 8px 0;
  color: var(--maps-muted);
  font-size: 14px;
  font-weight: 700;
}

.map-create-wizard > nav i {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid var(--maps-rule-strong);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.62);
  font-style: normal;
}

.map-create-wizard > nav i svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.map-create-wizard > nav .is-current { color: var(--maps-ink); }
.map-create-wizard > nav .is-current i { border-color: var(--maps-ink); background: var(--maps-yellow); }
.map-create-wizard > nav .is-complete { color: var(--maps-success); }

.map-create-fields,
.map-create-review {
  display: grid;
  gap: 16px;
}

.map-create-fields > div {
  display: grid;
  grid-template-columns: minmax(180px, 0.45fr) minmax(260px, 1fr);
  gap: 12px;
}

.map-create-fields label,
.map-quick-panel form > label,
.map-quick-panel form > div > label {
  display: grid;
  gap: 7px;
  color: var(--maps-ink);
  font-size: 14px;
  font-weight: 750;
}

.map-create-fields label > span { color: var(--maps-muted); font-weight: 500; }

.map-source-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.map-source-choices > button {
  display: grid;
  min-height: 158px;
  align-content: start;
  justify-items: start;
  gap: 8px;
  padding: 18px;
  color: var(--maps-ink);
  border: 1px solid var(--maps-rule-strong);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  text-align: left;
}

.map-source-choices > button.is-selected {
  border-color: var(--maps-ink);
  background: var(--maps-record);
  box-shadow: inset 0 0 0 2px var(--maps-yellow-strong);
}

.map-source-choices > button > span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--maps-rule);
  border-radius: 12px;
  background: var(--maps-paper);
}

.map-source-choices svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.map-source-choices strong { font-size: 17px; }
.map-source-choices small { color: var(--maps-muted); font-size: 14px; line-height: 1.45; }

.map-create-review dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border: 1px solid var(--maps-rule);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
}

.map-create-review dl > div { padding: 16px; border-right: 1px solid var(--maps-rule); }
.map-create-review dl > div:last-child { border-right: 0; }
.map-create-review dt { color: var(--maps-muted); font-size: 13px; }
.map-create-review dd { margin: 5px 0 0; font-size: 15px; font-weight: 750; }

.map-create-review fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.map-create-review legend { margin-bottom: 8px; font-size: 15px; font-weight: 800; }
.map-create-review fieldset label { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; padding: 13px; border: 1px solid var(--maps-rule); border-radius: 12px; background: rgba(255, 255, 255, 0.62); }
.map-create-review fieldset span { display: grid; gap: 2px; }
.map-create-review fieldset small { color: var(--maps-muted); font-size: 13px; }

.map-create-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Quick settings panel */

.map-quick-panel {
  position: fixed;
  z-index: 60;
  top: 92px;
  right: clamp(18px, 3vw, 44px);
  display: grid;
  width: min(430px, calc(100vw - 36px));
  max-height: calc(100dvh - 116px);
  gap: 20px;
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--maps-rule);
  border-radius: 16px;
  background: var(--maps-record);
  box-shadow: 0 24px 58px rgba(43, 41, 37, 0.2), 0 4px 12px rgba(43, 41, 37, 0.08);
}

.map-quick-panel form { display: grid; gap: 14px; }
.map-quick-panel form > div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Editor shell */

#admin-view .view-heading {
  align-items: end;
  scroll-margin-top: 84px;
}

#admin-view .view-heading-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

#admin-view .map-workspace-back svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

#admin-view .admin-layout {
  grid-template-columns: 204px minmax(470px, 1fr) minmax(300px, 330px);
}

#admin-view .setup-step {
  grid-template-columns: 38px minmax(0, 1fr);
}

#admin-view .setup-step > svg:last-child { display: none; }

#admin-view .setup-step__icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--maps-muted);
  border: 1px solid var(--maps-rule);
  border-radius: 11px;
  background: var(--maps-record);
}

#admin-view .setup-step__icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

#admin-view .setup-step.is-active .setup-step__icon {
  color: var(--maps-ink);
  border-color: #d2bc2f;
  background: var(--maps-yellow);
}

#admin-view .editor-toolbar {
  min-height: 66px;
  padding-inline: 16px;
}

#admin-view .editor-toolbar > div:first-child {
  display: grid;
  gap: 1px;
}

#admin-view .editor-toolbar > div:first-child span {
  color: var(--maps-muted);
  font-size: 13px;
}

#admin-view .editor-toolbar-actions .button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 14px;
}

#admin-view .editor-add-action svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

#admin-view .layers-panel .settings-section {
  margin: 0;
}

.layers-section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.layers-section-heading h3,
.layers-section-heading p { margin: 0; }
.layers-section-heading p { margin-top: 3px; color: var(--maps-muted); font-size: 13px; }
.layers-section-heading > span { display: grid; min-width: 28px; height: 28px; place-items: center; border-radius: 999px; background: var(--maps-paper-deep); font-size: 13px; font-weight: 800; }

.map-category-list {
  display: grid;
  margin-top: 10px;
  border: 1px solid var(--maps-rule);
  border-radius: 12px;
}

.map-category-row {
  display: grid;
  min-height: 60px;
  grid-template-columns: 11px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--maps-rule);
}

.map-category-row:last-child { border-bottom: 0; }
.map-category-row > span:nth-child(2) { display: grid; gap: 1px; }
.map-category-row strong { font-size: 14px; }
.map-category-row small { color: var(--maps-muted); font-size: 12px; }
.map-category-swatch { width: 8px; height: 30px; border-radius: 999px; background: var(--category-color); }

.shape-properties-panel form { display: grid; gap: 16px; }
.shape-properties-panel fieldset { margin: 0; padding: 14px; border: 1px solid var(--maps-rule); border-radius: 12px; }
.shape-properties-panel legend { padding-inline: 5px; font-weight: 800; }
.shape-properties-panel legend span { color: var(--maps-muted); font-size: 12px; font-weight: 500; }
.shape-properties-panel fieldset > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.shape-properties-panel fieldset label { display: grid; gap: 5px; color: var(--maps-muted); font-size: 13px; font-weight: 700; }

#admin-view :where(.details-panel__eyebrow, .rail-kicker),
.map-create-wizard > header > div > span,
.map-quick-panel > header > div > span,
.map-preview-dialog__header > div > span { display: none; }

/* Preview */

.map-preview-overlay {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(43, 41, 37, 0.54);
}

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

.map-preview-dialog {
  display: grid;
  width: min(1180px, 100%);
  max-height: calc(100dvh - 48px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 16px;
  background: var(--maps-record);
  box-shadow: 0 30px 80px rgba(43, 41, 37, 0.28), 0 6px 18px rgba(43, 41, 37, 0.14);
}

.map-preview-dialog__header,
.map-preview-dialog__footer {
  padding: 20px 24px;
  border-bottom: 1px solid var(--maps-rule);
}

.map-preview-dialog__body {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 0;
  overflow: auto;
  background: var(--maps-paper-deep);
}

.map-preview-canvas {
  position: relative;
  min-height: 540px;
  overflow: hidden;
  border-right: 1px solid var(--maps-rule);
  background: var(--maps-paper);
}

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

.map-preview-room {
  position: absolute;
  display: grid;
  align-content: start;
  min-width: 42px;
  min-height: 34px;
  padding: 5px;
  overflow: hidden;
  color: var(--maps-info);
  border: 1.5px solid rgba(32, 87, 93, 0.62);
  background: rgba(232, 243, 242, 0.58);
  pointer-events: none;
}

.map-preview-room.has-assets {
  border-color: rgba(139, 92, 18, 0.72);
  background: rgba(255, 242, 212, 0.62);
}

.map-preview-room strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.map-preview-room small { font-size: 10px; }

.map-preview-marker {
  position: absolute;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--maps-ink);
  border: 1px solid #d0b816;
  border-radius: 50%;
  background: var(--maps-yellow);
  transform: translate(-50%, -50%);
  box-shadow: 0 5px 12px rgba(43, 41, 37, 0.18);
}

.map-preview-marker svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.map-preview-shape {
  position: absolute;
  display: grid;
  z-index: 3;
  place-items: center;
  color: var(--maps-info);
  border: 1.5px solid currentColor;
  background: rgba(232, 243, 242, 0.78);
  pointer-events: none;
}

.map-preview-shape--circle { border-radius: 50%; background: rgba(255, 242, 212, 0.36); }
.map-preview-shape--line { height: 2px !important; min-height: 2px; border: 0; background: var(--maps-info); transform: rotate(-28deg); transform-origin: left center; }
.map-preview-shape--label { justify-items: start; padding: 4px 6px; overflow: hidden; color: var(--maps-ink); border-color: var(--maps-rule-strong); border-radius: 6px; background: rgba(255, 255, 255, 0.88); font-size: 10px; font-weight: 800; }
.map-preview-shape:not(.map-preview-shape--circle):not(.map-preview-shape--line):not(.map-preview-shape--label) { min-width: 26px; min-height: 26px; border-radius: 8px; }
.map-preview-shape__icon { width: 62%; height: 62%; fill: none; stroke: currentColor; stroke-width: 1.8; }

.map-preview-summary {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 24px;
  background: var(--maps-record);
}

.map-preview-summary h3 { margin: 0; font-size: 20px; }
.map-preview-summary p { margin: -8px 0 0; color: var(--maps-muted); font-size: 14px; line-height: 1.5; }
.map-preview-summary dl { display: grid; gap: 0; margin: 0; border-top: 1px solid var(--maps-rule); }
.map-preview-summary dl > div { display: grid; gap: 3px; padding: 12px 0; border-bottom: 1px solid var(--maps-rule); }
.map-preview-summary dt { color: var(--maps-muted); font-size: 12px; }
.map-preview-summary dd { margin: 0; font-size: 14px; font-weight: 700; }

.map-preview-empty {
  display: grid;
  min-height: 500px;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 32px;
  text-align: center;
}

.map-preview-empty > span { display: grid; width: 54px; height: 54px; place-items: center; border: 1px solid var(--maps-rule); border-radius: 14px; background: var(--maps-record); }
.map-preview-empty svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.map-preview-empty h3 { margin: 0; }
.map-preview-empty p { max-width: 42ch; margin: 0; color: var(--maps-muted); }

.map-preview-dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--maps-rule);
  border-bottom: 0;
}

@media (max-width: 1240px) {
  .map-gallery { grid-template-columns: repeat(2, minmax(280px, 1fr)); }
  .maps-recent > div { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #admin-view .admin-layout { grid-template-columns: 196px minmax(0, 1fr); }
}

@media (max-width: 940px) {
  #admin-view .admin-layout { grid-template-columns: minmax(0, 1fr); }
  .maps-register { grid-template-columns: repeat(3, 1fr); }
  .maps-register > p { grid-column: 1 / -1; border-top: 1px solid var(--maps-rule); }
  .maps-register > div:nth-child(3) { border-right: 0; }
  .maps-library > header { align-items: start; flex-direction: column; }
  .maps-library-controls { width: 100%; flex-wrap: wrap; }
  .maps-search { width: 100%; }
  .maps-library-controls label:not(.maps-search) { flex: 1; }
  .maps-library-controls select { width: 100%; }
  #admin-view .setup-rail { grid-template-columns: repeat(5, minmax(150px, 1fr)); }
  .map-preview-dialog__body { grid-template-columns: 1fr; }
  .map-preview-canvas { min-height: 480px; border-right: 0; border-bottom: 1px solid var(--maps-rule); }
}

@media (max-width: 690px) {
  #admin-view .setup-rail {
    grid-template-columns: repeat(5, minmax(58px, 1fr));
    overflow-x: clip;
  }
  #admin-view .setup-rail-heading,
  #admin-view .setup-rail-note { display: none; }
  #admin-view .setup-step {
    min-width: 0;
    min-height: 68px;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 4px;
    padding: 7px 3px;
  }
  #admin-view .setup-step > span:not(.setup-step__icon) { display: block; min-width: 0; text-align: center; }
  #admin-view .setup-step > span:not(.setup-step__icon) strong { display: block; overflow: visible; font-size: 10px; line-height: 1.05; text-overflow: clip; white-space: normal; }
  #admin-view .setup-step > span:not(.setup-step__icon) small { display: none; }
  #admin-view .setup-step__icon { width: 36px; height: 36px; }
  #admin-view .view-heading { gap: 8px; margin-bottom: 12px; }
  #admin-view .view-heading > div:first-child { display: grid; gap: 4px; }
  #admin-view .view-heading h1 { font-size: clamp(32px, 9vw, 36px); }
  #admin-view .view-heading p { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
  #admin-view .view-heading-actions { display: grid; width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  #admin-view .view-heading-actions .map-workspace-back { grid-column: 1 / 2; justify-self: start; }
  #admin-view .view-heading-actions .draft-status { grid-column: 2 / 4; justify-self: end; }
  #admin-view .view-heading-actions .button { width: 100%; min-height: 40px; padding-inline: 6px; }
  .maps-dashboard { gap: 24px; }
  .maps-register { grid-template-columns: repeat(2, 1fr); }
  .maps-register > div { border-bottom: 1px solid var(--maps-rule); }
  .maps-register > div:nth-child(2) { border-right: 0; }
  .maps-register > div:nth-child(3) { grid-column: 1 / -1; border-right: 0; }
  .maps-recent > div,
  .map-gallery,
  .map-source-choices,
  .map-create-review dl,
  .map-create-fields > div { grid-template-columns: 1fr; }
  .maps-recent > header,
  .maps-library > header { align-items: start; }
  .map-create-wizard > nav > span { align-items: start; flex-direction: column; font-size: 12px; }
  .map-create-review dl > div { border-right: 0; border-bottom: 1px solid var(--maps-rule); }
  .map-create-review dl > div:last-child { border-bottom: 0; }
  .map-create-footer { flex-direction: column-reverse; }
  .map-create-footer .button { width: 100%; }
  .map-quick-panel { top: 168px; right: 10px; width: calc(100vw - 20px); max-height: calc(100dvh - 186px); }
  #admin-view .view-heading-actions { justify-content: flex-start; }
  #admin-view .editor-upload-action { display: none; }
  .map-preview-overlay { padding: 10px; }
  .map-preview-dialog { max-height: calc(100dvh - 20px); }
  .map-preview-dialog__header,
  .map-preview-dialog__footer { padding: 16px; }
  .map-preview-canvas { min-height: 390px; }
  .map-preview-dialog__footer { flex-direction: column-reverse; }
  .map-preview-dialog__footer .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .map-gallery-card { animation: none; }
}
