/* ==========================================================================
   香港十八区住宅价格与地标交互地图工作室 — Studio Stylesheet
   ========================================================================== */

:root {
  --bg-ocean: #071528;
  --bg-chrome: #091322;
  --bg-panel: #0C182B;
  --bg-card: #12223A;
  --bg-card-hover: #182C4A;
  --bg-input: #091424;

  --border-subtle: rgba(126, 174, 232, 0.16);
  --border-strong: rgba(126, 174, 232, 0.32);
  --border-focus: rgba(56, 189, 248, 0.72);

  --text-primary: #F1F6FC;
  --text-secondary: #9CB7D6;
  --text-muted: #6C8BB0;

  --accent-brand: #E84A33;
  --accent-cyan: #38BDF8;
  --accent-gold: #FFD166;
  --accent-green: #4ADE80;
  --accent-danger: #F87171;

  --topbar-h: 52px;
  --drawer-w: 356px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-sans: "PingFang SC", -apple-system, BlinkMacSystemFont, "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;

  --shadow-float: 0 12px 32px rgba(2, 8, 20, 0.56), 0 1px 0 rgba(255, 255, 255, 0.05) inset;
  --shadow-modal: 0 24px 64px rgba(2, 8, 20, 0.78), 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-ocean);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

/* ==========================================================================
   Top Studio Toolbar
   ========================================================================== */

.topbar {
  height: var(--topbar-h);
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(9, 19, 34, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  z-index: 40;
  user-select: none;
  transition: margin-top 0.22s ease, opacity 0.22s ease;
}

body.is-zen .topbar {
  margin-top: calc(var(--topbar-h) * -1);
  opacity: 0;
  pointer-events: none;
}

.topbar-left,
.topbar-center,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(232, 74, 51, 0.22), rgba(14, 165, 233, 0.16));
  border: 1px solid rgba(255, 209, 102, 0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
  margin: 0 2px;
  flex-shrink: 0;
}

/* Region Jump Pills */
.region-pills {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 9px;
  background: rgba(6, 14, 27, 0.72);
  border: 1px solid var(--border-subtle);
}

.pill-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.pill-btn:hover {
  color: var(--text-primary);
  background: rgba(126, 174, 232, 0.12);
}

.pill-btn.is-active {
  background: rgba(56, 189, 248, 0.18);
  color: #E0F2FE;
  font-weight: 600;
}

/* Layer Toggles */
.layer-pills {
  display: flex;
  align-items: center;
  gap: 4px;
}

.layer-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border-subtle);
  background: rgba(12, 24, 43, 0.65);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.layer-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.layer-pill.is-on {
  background: rgba(24, 44, 74, 0.92);
  border-color: rgba(126, 174, 232, 0.34);
  color: var(--text-primary);
}

.layer-pill:not(.is-on) .dot {
  opacity: 0.32;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.dot-uni {
  background: var(--accent-cyan);
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.7);
}

.dot-lm {
  background: var(--accent-gold);
  border-radius: 1.5px;
  transform: rotate(45deg);
}

.dot-area {
  background: #F2F7FF;
}

.dot-water {
  background: #6493C2;
}

.dot-title {
  background: var(--accent-brand);
  border-radius: 2px;
}

.dot-extra {
  background: #8CAFD6;
}

/* Right Action Buttons */
.history-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.icon-btn:hover:not(:disabled) {
  background: rgba(126, 174, 232, 0.14);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.icon-btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

.action-btn {
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: rgba(18, 34, 58, 0.85);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.action-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.action-btn.is-active {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.56);
  color: #E0F2FE;
}

.action-btn.is-mode-active {
  background: rgba(255, 209, 102, 0.18);
  border-color: rgba(255, 209, 102, 0.7);
  color: #FEF3C7;
}

.action-primary {
  background: linear-gradient(135deg, #0EA5E9, #0284C7);
  border-color: rgba(125, 211, 252, 0.45);
  color: #FFFFFF;
  font-weight: 600;
}

.action-primary:hover {
  background: linear-gradient(135deg, #38BDF8, #0EA5E9);
  border-color: rgba(186, 230, 253, 0.65);
}

/* Dropdown Menu */
.dropdown-wrap {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 214px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(12, 24, 43, 0.97);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-float);
  z-index: 60;
}

.dropdown-item {
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  transition: background 0.12s ease;
}

.dropdown-item:hover {
  background: rgba(56, 189, 248, 0.15);
}

.dropdown-item-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.dropdown-item-meta {
  font-size: 11px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.dropdown-sep {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 6px;
}

/* ==========================================================================
   Workspace Layout
   ========================================================================== */

.studio-workspace {
  height: calc(100vh - var(--topbar-h));
  display: flex;
  position: relative;
  overflow: hidden;
  transition: height 0.22s ease;
}

body.is-zen .studio-workspace {
  height: 100vh;
}

/* ==========================================================================
   Interactive Map Stage
   ========================================================================== */

.map-stage {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: var(--bg-ocean);
  user-select: none;
  touch-action: none;
}

.map-stage.mode-pan {
  cursor: grab;
}

.map-stage.mode-pan.is-panning {
  cursor: grabbing;
}

.map-stage.mode-add,
.map-stage.mode-crop {
  cursor: crosshair;
}

.hk-map-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Interactive SVG Elements */
.hk-map-svg .district-path {
  cursor: pointer;
  transition: filter 0.14s ease;
}

.hk-map-svg .district-path:hover {
  filter: brightness(1.09);
}

.hk-map-svg .district-path.is-selected {
  stroke: #FFF3B0 !important;
  stroke-width: 6.5px !important;
  filter: brightness(1.08);
}

.hk-map-svg .district-label-group {
  cursor: pointer;
}

.hk-map-svg .district-label-group.is-draggable {
  cursor: grab;
}

.hk-map-svg .district-label-group.is-dragging {
  cursor: grabbing;
}

.hk-map-svg .landmark-pin-group {
  cursor: pointer;
}

.hk-map-svg .landmark-label-group {
  cursor: grab;
}

.hk-map-svg .landmark-label-group:hover text {
  filter: brightness(1.18);
}

.hk-map-svg .landmark-label-group.is-dragging {
  cursor: grabbing;
}

.map-stage.mode-add .hk-map-svg .district-path,
.map-stage.mode-add .hk-map-svg .district-label-group,
.map-stage.mode-add .hk-map-svg .landmark-label-group,
.map-stage.mode-add .hk-map-svg .landmark-pin-group,
.map-stage.mode-crop .hk-map-svg * {
  cursor: crosshair !important;
}

/* Active Mode Banner */
.mode-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 34;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px 7px 14px;
  border-radius: 999px;
  background: rgba(10, 22, 40, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 209, 102, 0.48);
  box-shadow: var(--shadow-float);
  font-size: 12.5px;
  color: #FEF3C7;
  white-space: nowrap;
}

.mode-banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-gold);
  box-shadow: 0 0 8px var(--accent-gold);
}

.mode-banner-btn {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 999px;
  transition: background 0.14s ease;
}

.mode-banner-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Floating Stage Restore Pills */
.stage-fab {
  position: absolute;
  z-index: 24;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(10, 22, 40, 0.88);
  backdrop-filter: blur(12px);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-float);
  transition: all 0.16s ease;
}

.stage-fab:hover {
  background: rgba(20, 38, 66, 0.96);
  border-color: rgba(56, 189, 248, 0.56);
}

.stage-fab-right {
  top: 14px;
  right: 14px;
}

.stage-fab-top {
  top: 14px;
  right: 14px;
  opacity: 0.72;
}

.stage-fab-top:hover {
  opacity: 1;
}

/* Bottom-Left Zoom Controls & Hover Pill (Bottom-Right remains 100% unobstructed!) */
.stage-bottom-left {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.zoom-controls {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 10px;
  background: rgba(9, 20, 36, 0.86);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-float);
}

.zoom-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease;
}

.zoom-btn:hover {
  background: rgba(126, 174, 232, 0.16);
}

.zoom-readout {
  min-width: 50px;
  height: 28px;
  padding: 0 6px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.zoom-readout:hover {
  background: rgba(126, 174, 232, 0.14);
  color: var(--text-primary);
}

.zoom-sep {
  width: 1px;
  height: 16px;
  background: var(--border-subtle);
  margin: 0 2px;
}

.hover-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(9, 20, 36, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-float);
  font-size: 12px;
  white-space: nowrap;
}

.hover-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}

.hover-title {
  font-weight: 600;
  color: var(--text-primary);
}

.hover-meta {
  color: var(--accent-gold);
  font-variant-numeric: tabular-nums;
}

/* Box-Select Crop Overlay */
.crop-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  cursor: crosshair;
}

.crop-mask {
  position: absolute;
  background: rgba(3, 9, 20, 0.56);
  pointer-events: none;
}

.crop-box {
  position: absolute;
  border: 2px dashed var(--accent-gold);
  box-shadow: 0 0 0 1px rgba(7, 20, 36, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.crop-dims {
  position: absolute;
  top: -28px;
  left: 0;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(8, 19, 36, 0.94);
  border: 1px solid rgba(255, 209, 102, 0.52);
  color: var(--accent-gold);
  font-size: 11px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.crop-actions {
  position: absolute;
  z-index: 32;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(9, 20, 36, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-float);
  cursor: default;
}

.crop-act-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 7px;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.crop-act-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.crop-act-primary {
  background: linear-gradient(135deg, #0EA5E9, #0284C7);
  border-color: rgba(125, 211, 252, 0.5);
  font-weight: 600;
}

.crop-act-primary:hover {
  background: linear-gradient(135deg, #38BDF8, #0EA5E9);
}

.crop-act-ghost {
  background: transparent;
  color: var(--text-secondary);
}

/* Loading / Error Overlay */
.stage-status {
  position: absolute;
  inset: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 21, 40, 0.84);
  backdrop-filter: blur(6px);
}

.stage-status-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-radius: 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-modal);
  color: var(--text-primary);
  font-size: 13.5px;
  max-width: 440px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(56, 189, 248, 0.25);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

/* ==========================================================================
   Collapsible Right-Side Editor Drawer
   ========================================================================== */

.editor-drawer {
  width: var(--drawer-w);
  flex: 0 0 var(--drawer-w);
  height: 100%;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.22s ease, flex-basis 0.22s ease, border-color 0.22s ease;
  z-index: 26;
}

.editor-drawer.is-collapsed,
body.is-zen .editor-drawer {
  width: 0;
  flex-basis: 0;
  border-left-color: transparent;
}

.drawer-header {
  padding: 12px 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  min-width: var(--drawer-w);
}

.drawer-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.save-badge {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(74, 222, 128, 0.12);
  color: #86EFAC;
  border: 1px solid rgba(74, 222, 128, 0.26);
}

.drawer-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 8px 12px;
  background: rgba(6, 14, 27, 0.45);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  min-width: var(--drawer-w);
}

.drawer-tab {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 7px;
  transition: all 0.15s ease;
}

.drawer-tab:hover {
  color: var(--text-primary);
  background: rgba(126, 174, 232, 0.1);
}

.drawer-tab.is-active {
  background: var(--bg-card);
  color: #FFFFFF;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(126, 174, 232, 0.22);
}

.tab-panel {
  flex: 1 1 auto;
  min-height: 0;
  min-width: var(--drawer-w);
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Custom Dark Scrollbar */
.tab-panel::-webkit-scrollbar,
.item-list::-webkit-scrollbar {
  width: 6px;
}

.tab-panel::-webkit-scrollbar-track,
.item-list::-webkit-scrollbar-track {
  background: transparent;
}

.tab-panel::-webkit-scrollbar-thumb,
.item-list::-webkit-scrollbar-thumb {
  background: rgba(126, 174, 232, 0.22);
  border-radius: 99px;
}

.tab-panel::-webkit-scrollbar-thumb:hover,
.item-list::-webkit-scrollbar-thumb:hover {
  background: rgba(126, 174, 232, 0.4);
}

.panel-toolbar-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Switch Rows */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  user-select: none;
}

.switch-row:hover {
  border-color: var(--border-strong);
}

.switch-compact {
  padding: 7px 10px;
}

.switch-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.switch-compact .switch-label {
  flex-direction: row;
  align-items: center;
  gap: 7px;
}

.switch-label strong {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.switch-label small {
  font-size: 11px;
  color: var(--text-muted);
}

.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  width: 34px;
  height: 19px;
  border-radius: 999px;
  background: rgba(108, 139, 176, 0.34);
  position: relative;
  flex-shrink: 0;
  transition: background 0.16s ease;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: transform 0.16s ease;
}

.toggle-input:checked + .toggle-track {
  background: var(--accent-cyan);
}

.toggle-input:checked + .toggle-track::after {
  transform: translateX(15px);
}

/* Buttons */
.btn-secondary,
.btn-accent,
.btn-danger {
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.15s ease;
}

.btn-full {
  width: 100%;
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: rgba(126, 174, 232, 0.48);
}

.btn-accent {
  background: linear-gradient(135deg, #0EA5E9, #0284C7);
  border: 1px solid rgba(125, 211, 252, 0.48);
  color: #FFFFFF;
}

.btn-accent:hover {
  background: linear-gradient(135deg, #38BDF8, #0EA5E9);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #FCA5A5;
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.24);
  border-color: rgba(248, 113, 113, 0.7);
  color: #FEE2E2;
}

.ramp-chip {
  width: 34px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #B71C1C 0%, #F98744 35%, #F1E26E 62%, #6EC888 85%, #CEF7D6 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.mini-btn {
  border: 1px solid var(--border-subtle);
  background: rgba(9, 20, 36, 0.65);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 6px;
  transition: all 0.14s ease;
}

.mini-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.mini-danger {
  color: #FCA5A5;
  border-color: rgba(248, 113, 113, 0.32);
}

.mini-danger:hover {
  background: rgba(248, 113, 113, 0.22);
  border-color: rgba(248, 113, 113, 0.65);
  color: #FEE2E2;
}

/* Editor Cards */
.editor-card {
  padding: 12px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(22, 41, 69, 0.92), rgba(15, 30, 52, 0.92));
  border: 1px solid rgba(56, 189, 248, 0.34);
  box-shadow: 0 8px 20px rgba(2, 8, 20, 0.32);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.editor-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.editor-card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.swatch-lg {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  flex-shrink: 0;
}

.card-heading {
  font-size: 14px;
  font-weight: 700;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.editor-card-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.empty-hint {
  padding: 11px 12px;
  border-radius: var(--radius-md);
  background: rgba(18, 34, 58, 0.45);
  border: 1px dashed var(--border-subtle);
  color: var(--text-muted);
  font-size: 12px;
}

/* Form Elements */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.field-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.field-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.text-input,
.select-input {
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.text-input:focus,
.select-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.16);
}

.mono-input,
.mono-text {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.color-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-picker {
  width: 32px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-input);
  cursor: pointer;
  flex-shrink: 0;
}

.xy-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
  padding: 2px;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 4px;
  border-radius: 6px;
  transition: all 0.14s ease;
}

.seg-btn:hover {
  color: var(--text-primary);
}

.seg-btn.is-active {
  background: rgba(56, 189, 248, 0.22);
  color: #E0F2FE;
  font-weight: 600;
}

.card-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 2px;
}

.drag-tip {
  font-size: 11px;
  color: var(--text-muted);
}

/* Search & Filter Chips */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 32px;
  padding: 0 10px 0 30px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 12.5px;
  outline: none;
}

.search-input:focus {
  border-color: var(--border-focus);
}

.chip-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.chip-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 4px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.14s ease;
}

.chip-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.chip-btn.is-active {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.5);
  color: #E0F2FE;
}

.chip-count {
  font-size: 10.5px;
  opacity: 0.78;
  font-variant-numeric: tabular-nums;
}

/* List Items */
.list-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 2px 2px 0;
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.district-row,
.landmark-row {
  width: 100%;
  border: 1px solid var(--border-subtle);
  background: rgba(18, 34, 58, 0.62);
  border-radius: 9px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  transition: all 0.12s ease;
}

.district-row:hover,
.landmark-row:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.district-row.is-selected,
.landmark-row.is-selected {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.58);
}

.row-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.rank-num {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
  width: 20px;
  flex-shrink: 0;
}

.swatch-sm {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  flex-shrink: 0;
}

.row-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-price {
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--accent-gold);
  background: rgba(7, 20, 36, 0.7);
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.row-dist-tag {
  font-size: 11px;
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(7, 20, 36, 0.55);
  flex-shrink: 0;
}

.lm-badge-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lm-badge-icon.cat-university {
  background: rgba(14, 165, 233, 0.22);
  border: 1px solid rgba(56, 189, 248, 0.65);
  color: #7DD3FC;
}

.lm-badge-icon.cat-landmark {
  background: rgba(255, 209, 102, 0.16);
  border: 1px solid rgba(255, 209, 102, 0.6);
  color: #FFD166;
}

.lm-badge-icon.cat-area {
  background: rgba(242, 247, 255, 0.12);
  border: 1px solid rgba(242, 247, 255, 0.45);
  color: #FFFFFF;
}

/* Settings Tab Sections */
.settings-section {
  padding: 12px;
  border-radius: var(--radius-lg);
  background: rgba(18, 34, 58, 0.55);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.section-desc {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-muted);
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.slider-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.mono-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(7, 20, 36, 0.8);
  border: 1px solid var(--border-subtle);
  color: #BAE6FD;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.backup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ==========================================================================
   Modals & Toasts
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 9, 20, 0.72);
  backdrop-filter: blur(6px);
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 400px;
  padding: 18px;
  border-radius: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-card-sm {
  max-width: 350px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.modal-card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.modal-desc {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 95;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 9px 16px;
  border-radius: 10px;
  background: rgba(9, 21, 39, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(56, 189, 248, 0.45);
  box-shadow: var(--shadow-float);
  color: #F1F6FC;
  font-size: 12.5px;
  font-weight: 500;
  animation: toastIn 0.2s ease;
}

.toast.toast-error {
  border-color: rgba(248, 113, 113, 0.65);
  color: #FECACA;
}

.toast.toast-success {
  border-color: rgba(74, 222, 128, 0.55);
  color: #DCFCE7;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1320px) {
  .brand-title {
    display: none;
  }
  .layer-pill {
    padding: 4px 7px;
  }
}

@media (max-width: 1120px) {
  .topbar-center {
    display: none;
  }
  :root {
    --drawer-w: 324px;
  }
}

@media (max-width: 820px) {
  .region-pills {
    display: none;
  }
  .editor-drawer {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    box-shadow: -12px 0 36px rgba(2, 8, 20, 0.72);
  }
}
