:root {
  --bg: #f7f4ef;
  --panel: rgba(255, 255, 255, 0.76);
  --panel-solid: #fffefd;
  --panel-soft: rgba(248, 250, 247, 0.72);
  --glass: rgba(255, 255, 255, 0.68);
  --glass-strong: rgba(255, 255, 255, 0.84);
  --ink: #1d252d;
  --muted: #6b737d;
  --line: rgba(63, 72, 84, 0.14);
  --line-strong: rgba(63, 72, 84, 0.24);
  --accent: #2f6fdd;
  --accent-soft: rgba(47, 111, 221, 0.10);
  --success: #247856;
  --success-soft: rgba(36, 120, 86, 0.11);
  --danger: #b64b2d;
  --danger-soft: rgba(182, 75, 45, 0.10);
  --warning: #aa6a24;
  --edit-soft: rgba(255, 246, 232, 0.86);
  --zone: #247856;
  --zone-line: rgba(36, 120, 86, 0.48);
  --zone-rest: rgba(36, 120, 86, 0.028);
  --zone-hover: rgba(36, 120, 86, 0.11);
  --zone-selected: rgba(47, 111, 221, 0.14);
  --focus: 0 0 0 3px rgba(47, 111, 221, 0.18);
  --shadow: 0 18px 46px rgba(43, 51, 60, 0.13);
  --soft-shadow: 0 10px 28px rgba(43, 51, 60, 0.08);
  --radius: 8px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(145deg, #f7f1e9 0%, #eef6f1 48%, #f5f7fb 100%);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button,
.file-button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible,
.file-line:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.hidden {
  display: none !important;
}

.app-shell {
  height: 100%;
  min-height: 100%;
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.62);
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(1.25);
  -webkit-backdrop-filter: blur(22px) saturate(1.25);
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 1px 0 rgba(63, 72, 84, 0.08), 0 10px 28px rgba(43, 51, 60, 0.05);
}

.brand {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #267865 0%, #3d78d4 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 10px 22px rgba(39, 120, 101, 0.18);
  font-size: 13px;
  font-weight: 650;
}

.brand-copy {
  min-width: 0;
}

.brand-copy h1,
.brand-copy p,
.drawer-heading h2,
.drawer-heading p,
.details-header h2,
.details-header p {
  margin: 0;
}

.brand-copy h1 {
  font-size: 18px;
  line-height: 1.1;
  font-weight: 650;
}

.brand-copy p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(52vw, 560px);
}

.header-actions,
.toolbar-group,
.form-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.button,
.file-button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  color: var(--ink);
  background: var(--glass-strong);
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.2;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.button:hover,
.file-button:hover {
  transform: translateY(-1px);
  border-color: rgba(47, 111, 221, 0.22);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--soft-shadow);
}

.button.primary {
  color: #fff;
  background: linear-gradient(135deg, #2f6fdd 0%, #2f7f70 100%);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(47, 111, 221, 0.18);
}

.button.secondary {
  color: #1e6148;
  background: var(--success-soft);
  border-color: rgba(36, 120, 86, 0.18);
}

.button.neutral,
.button.ghost,
.file-button {
  border-color: var(--line);
  background: var(--glass-strong);
}

.button.ghost {
  color: #394450;
  background: var(--panel-soft);
}

.button.danger {
  color: #8a2c0b;
  background: var(--danger-soft);
  border-color: #ffc9b5;
}

.button.disabled,
.button:disabled {
  color: var(--muted);
  background: rgba(233, 237, 243, 0.72);
  border-color: var(--line);
  opacity: 1;
  pointer-events: none;
}

.full-width {
  width: 100%;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 296px minmax(480px, 1fr) 380px;
  transition: grid-template-columns 180ms ease;
}

body.panel-closed .workspace {
  grid-template-columns: 296px minmax(480px, 1fr) 0;
}

.sidebar,
.details-pane,
.map-area {
  min-height: 0;
  min-width: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.54);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  border-right: 1px solid var(--line);
}

.search-box {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.search-box input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px 0 38px;
  color: var(--ink);
  background: var(--glass-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.search-box input::placeholder {
  color: #8a918f;
}

.search-results {
  display: grid;
  gap: 6px;
  max-height: 280px;
  overflow: auto;
}

.search-result,
.drawer-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--glass-strong);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.52);
}

.search-result {
  padding: 10px;
}

.search-result:hover,
.drawer-card:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: var(--soft-shadow);
}

.search-result strong,
.drawer-card strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result span,
.drawer-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #46505a;
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

.counter,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  color: #3f4953;
  background: var(--glass-strong);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.drawer-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 8px;
  padding-right: 2px;
}

.drawer-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
}

.drawer-card.active {
  border-color: rgba(47, 111, 221, 0.28);
  background: linear-gradient(90deg, rgba(47, 111, 221, 0.12), rgba(36, 120, 86, 0.09));
  box-shadow: inset 3px 0 0 var(--accent), 0 10px 22px rgba(47, 111, 221, 0.10);
}

.drawer-thumb {
  width: 58px;
  height: 46px;
  border-radius: 6px;
  object-fit: cover;
  background: rgba(237, 240, 244, 0.74);
  border: 1px solid var(--line);
}

.drawer-thumb.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
}

.sidebar-actions {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.map-area {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background:
    linear-gradient(155deg, rgba(250, 246, 239, 0.88), rgba(238, 246, 243, 0.74) 52%, rgba(243, 247, 252, 0.82));
}

.map-toolbar,
.map-subbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.64);
  backdrop-filter: blur(16px) saturate(1.18);
  -webkit-backdrop-filter: blur(16px) saturate(1.18);
  border-bottom: 1px solid var(--line);
}

.map-toolbar {
  min-height: 54px;
}

.drawer-heading {
  min-width: 0;
  margin-right: auto;
}

.drawer-heading h2 {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-heading p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.54);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.46);
}

.mode-button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 5px 10px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.mode-button.active {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.90);
  box-shadow: 0 4px 12px rgba(43, 51, 60, 0.08);
}

.is-editing .mode-button.active {
  color: var(--warning);
  background: var(--edit-soft);
}

.map-subbar {
  display: none;
}

.status-pill {
  margin-right: auto;
}

.mobile-drawer-select {
  display: none;
}

.status-pill.dirty {
  color: var(--warning);
  background: #fff7ed;
  border-color: #fed7aa;
}

.status-pill.saved {
  color: var(--success);
  background: var(--success-soft);
  border-color: #bfe8ca;
}

.zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tool-button {
  min-width: 34px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #46505a;
  background: var(--glass-strong);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.map-stage {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px;
  user-select: none;
  touch-action: pan-x pan-y;
}

.map-canvas {
  --zoom: 1;
  position: relative;
  width: min(100%, 760px);
  min-width: 0;
  margin: 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 22px 46px rgba(43, 51, 60, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.66);
  overflow: hidden;
}

.drawer-image {
  display: block;
  width: 100%;
  height: auto;
}

.drawer-image[src=""],
.drawer-image:not([src]) {
  display: none;
}

.empty-map {
  min-height: 420px;
  display: grid;
  place-items: center;
  gap: 6px;
  align-content: center;
  color: var(--muted);
  background:
    linear-gradient(90deg, rgba(133, 146, 157, 0.18) 1px, transparent 1px),
    linear-gradient(rgba(133, 146, 157, 0.18) 1px, transparent 1px),
    rgba(255, 255, 255, 0.58);
  background-size: 28px 28px;
}

.empty-map strong {
  color: #343b47;
}

.hotspot {
  position: absolute;
  min-width: 30px;
  min-height: 26px;
  border: 1px solid var(--zone-line);
  border-radius: 7px;
  background: var(--zone-rest);
  color: #0f172a;
  cursor: pointer;
  overflow: visible;
  touch-action: pan-x pan-y;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.hotspot:hover {
  border-color: var(--zone);
  background: var(--zone-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(36, 120, 86, 0.13);
}

.hotspot.selected {
  border-color: var(--accent);
  background: var(--zone-selected);
  box-shadow: 0 0 0 2px rgba(47, 111, 221, 0.20), 0 12px 24px rgba(47, 111, 221, 0.13);
  z-index: 10;
}

.hotspot.highlighted {
  border-color: var(--success);
  background: rgba(36, 120, 86, 0.12);
  box-shadow: 0 0 0 4px rgba(36, 120, 86, 0.15), 0 14px 28px rgba(36, 120, 86, 0.11);
  z-index: 11;
}

.hotspot-label {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3px;
  text-align: center;
  pointer-events: none;
  text-shadow: none;
}

.hotspot-label strong {
  display: -webkit-box;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 5px;
  padding: 2px 5px;
  color: #111827;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 1px 4px rgba(43, 51, 60, 0.13);
  font-size: 12px;
  line-height: 1.08;
  font-weight: 700;
  overflow-wrap: anywhere;
  white-space: normal;
}

.hotspot:hover .hotspot-label strong,
.hotspot.selected .hotspot-label strong {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(255, 255, 255, 0.9);
}

.hotspot.long-label .hotspot-label strong {
  font-size: 11px;
}

.hotspot.small-zone .hotspot-label strong {
  padding: 1px 4px;
  font-size: 10px;
  line-height: 1.05;
}

.resize-handle {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 5px;
  background: var(--accent);
  cursor: nwse-resize;
  display: none;
  box-shadow: 0 3px 10px rgba(43, 51, 60, 0.20);
}

.is-editing .resize-handle {
  display: block;
}

.is-editing .hotspot {
  cursor: move;
  touch-action: none;
}

.is-editing .map-stage {
  touch-action: none;
}

.edit-only {
  display: none;
}

.is-editing .edit-only {
  display: inline-flex;
}

body:not(.is-editing) .sidebar-actions,
body:not(.is-editing) .toolbar-group {
  display: none;
}

.details-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.66);
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  border-left: 1px solid var(--line);
}

.details-pane.closed {
  display: none;
}

.panel-collapse {
  position: absolute;
  left: -15px;
  top: 50%;
  z-index: 2;
  width: 30px;
  height: 52px;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 9px 0 0 9px;
  display: grid;
  place-items: center;
  color: #425066;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: -6px 10px 24px rgba(43, 51, 60, 0.10);
  cursor: pointer;
  transform: translateY(-50%);
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.panel-collapse span {
  display: block;
  font-size: 26px;
  line-height: 1;
}

.panel-collapse:hover {
  color: var(--accent);
  background: #fff;
  transform: translate(-2px, -50%);
}

.details-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.32);
}

.details-header h2 {
  font-size: 17px;
  line-height: 1.25;
  font-weight: 650;
}

.details-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.details-content {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.product-media {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 150px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.54);
}

.product-media:not(.has-image) {
  display: none;
}

.product-media img {
  display: none;
  width: 100%;
  max-height: 190px;
  object-fit: contain;
  padding: 10px;
}

.product-media.has-image img {
  display: block;
}

.product-media.has-image .product-placeholder {
  display: none;
}

.product-placeholder {
  color: var(--muted);
  font-size: 13px;
}

.info-list {
  display: grid;
  gap: 0;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--glass-strong);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.46);
}

.info-list div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.info-list div:last-child {
  border-bottom: 0;
}

.info-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.info-list dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  color: #242b36;
  font-size: 15px;
  font-weight: 650;
}

.info-list div:first-child dd {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.15;
}

.description {
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  color: #424b55;
  background: rgba(255, 255, 255, 0.58);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.54);
}

.tab {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 600;
}

.tab.active {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.90);
  box-shadow: 0 4px 12px rgba(43, 51, 60, 0.08);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 6px;
}

.form-grid label span,
.file-line span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.form-grid input,
.form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--glass-strong);
  padding: 9px 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.form-grid textarea {
  min-height: 104px;
  resize: vertical;
}

.form-grid .wide,
.form-actions {
  grid-column: 1 / -1;
}

.file-line {
  min-height: 58px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 255, 255, 0.54);
  cursor: pointer;
}

.file-line strong {
  color: var(--accent);
  font-size: 13px;
}

.drawer-qr {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.54);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.48);
}

.drawer-qr > div:first-child {
  display: grid;
  gap: 3px;
}

.drawer-qr span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

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

.drawer-qr-body {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.drawer-qr-code {
  width: 128px;
  height: 128px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: var(--panel-solid);
}

.drawer-qr-code svg {
  display: block;
  width: 100%;
  height: 100%;
}

.drawer-qr-code .qr-error {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--danger);
  text-align: center;
}

.drawer-qr-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.drawer-qr-copy input {
  font-size: 12px;
}

.form-actions {
  justify-content: stretch;
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 80;
  max-width: calc(100vw - 28px);
  padding: 11px 14px;
  border-radius: 999px;
  color: #fff;
  background: rgba(29, 37, 45, 0.94);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 180ms ease, transform 180ms ease;
  font-size: 13px;
  font-weight: 600;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.dialog {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(29, 37, 45, 0.42);
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
}

.dialog-box {
  width: min(460px, 100%);
  border-radius: 10px;
  padding: 18px;
  background: var(--glass-strong);
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow);
}

.dialog-box h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.dialog-box p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.45;
}

.dialog-actions {
  justify-content: flex-end;
}

.access-dialog {
  display: grid;
  gap: 12px;
}

.access-field {
  display: grid;
  gap: 6px;
}

.access-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.access-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 11px;
  color: var(--ink);
  background: var(--panel-solid);
}

.dialog-error {
  margin: -2px 0 0;
  color: #9a3412;
  font-size: 13px;
  font-weight: 650;
}

@media (max-width: 1220px) {
  .workspace {
    grid-template-columns: 272px minmax(420px, 1fr);
  }

  body.panel-closed .workspace {
    grid-template-columns: 272px minmax(420px, 1fr);
  }

  .details-pane {
    position: fixed;
    top: 72px;
    right: 12px;
    bottom: 12px;
    width: min(380px, calc(100vw - 24px));
    z-index: 40;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
  }

  .panel-collapse {
    left: -14px;
    top: 56px;
    transform: none;
  }

  .panel-collapse:hover {
    transform: translateX(-2px);
  }

  .details-pane.closed {
    display: none;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .app-header {
    position: static;
    align-items: center;
    flex-direction: row;
    gap: 10px;
    padding: 10px;
  }

  .header-actions {
    width: auto;
    min-width: 0;
  }

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

  body.panel-closed .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    gap: 10px;
    padding: 10px;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .search-box input {
    font-size: 16px;
  }

  .search-results {
    gap: 4px;
    max-height: 168px;
  }

  .search-result {
    padding: 7px 9px;
  }

  .search-result strong {
    font-size: 12px;
    line-height: 1.18;
    font-weight: 600;
  }

  .search-result span {
    margin-top: 2px;
    font-size: 10.5px;
    line-height: 1.2;
  }

  .section-title,
  .drawer-list {
    display: none;
  }

  .drawer-card {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 8px;
    padding: 6px;
  }

  .drawer-thumb {
    width: 48px;
    height: 36px;
  }

  .sidebar-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .sidebar-actions .button,
  .sidebar-actions .file-button {
    min-height: 34px;
    padding: 7px 6px;
    font-size: 11px;
  }

  .sidebar-actions .button span:last-child,
  .sidebar-actions .file-button span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .map-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
  }

  .drawer-heading h2 {
    font-size: 15px;
  }

  .drawer-heading p {
    display: none;
  }

  .mobile-drawer-select {
    display: grid;
    gap: 5px;
  }

  .mobile-drawer-select span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
    text-transform: uppercase;
  }

  .mobile-drawer-select select {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0 36px 0 11px;
    color: var(--ink);
    background: var(--glass-strong);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
  }

  .toolbar-group {
    width: 100%;
  }

  .header-actions .mode-switch {
    width: auto;
  }

  .toolbar-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .map-stage {
    padding: 8px;
  }

  .map-canvas {
    min-width: 0;
  }

  .hotspot-label {
    padding: 2px;
  }

  .hotspot-label strong {
    padding: 2px 4px;
    font-size: 11px;
    line-height: 1.05;
  }

  .hotspot.long-label .hotspot-label strong,
  .hotspot.small-zone .hotspot-label strong {
    font-size: 10px;
  }

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

  .drawer-qr-body {
    grid-template-columns: 1fr;
  }

  .drawer-qr-code {
    margin: 0 auto;
  }
}

@media (max-width: 430px) {
  .hotspot-label strong {
    padding: 1px 4px;
    font-size: 10px;
  }

  .hotspot.long-label .hotspot-label strong,
  .hotspot.small-zone .hotspot-label strong {
    padding: 1px 3px;
    font-size: 9px;
  }
}

@media (max-width: 410px) and (max-height: 900px) {
  .app-header {
    padding: 8px 10px;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    font-size: 11px;
  }

  .brand-copy h1 {
    font-size: 16px;
  }

  .brand-copy p {
    margin-top: 1px;
    font-size: 11px;
  }

  .sidebar {
    gap: 8px;
    padding: 8px;
  }

  .search-box input {
    height: 36px;
    padding-left: 34px;
    font-size: 16px;
  }

  .search-results {
    max-height: 138px;
  }

  .search-result {
    padding: 6px 8px;
  }

  .search-result strong {
    font-size: 11.5px;
  }

  .search-result span {
    font-size: 10px;
  }

  .search-icon {
    left: 11px;
  }

  .map-toolbar {
    gap: 6px;
    padding: 8px;
  }

  .drawer-heading h2 {
    font-size: 14px;
  }

  .mobile-drawer-select {
    gap: 3px;
  }

  .mobile-drawer-select span {
    font-size: 10px;
  }

  .mobile-drawer-select select {
    min-height: 36px;
    padding-left: 10px;
    font-size: 12px;
  }

  .mode-switch {
    gap: 2px;
    padding: 2px;
  }

  .mode-button {
    min-height: 28px;
    padding: 4px 8px;
    font-size: 12px;
  }

  .map-stage {
    padding: 6px;
  }
}

@supports (-webkit-touch-callout: none) {
  @media (max-width: 820px) {
    input,
    select,
    textarea {
      font-size: 16px !important;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}
