/* ============================================================
   Seatmap Studio — styles.css
   ============================================================ */

:root {
  --nav-h: 60px;
  --venue-h: 62px;
  --footer-h: 32px;
  --right-panel-w: 260px;

  --bg: #f5f6f8;
  --bg-white: #ffffff;
  --color-white: #ffffff;
  --bg-canvas: linear-gradient(135deg, rgba(174, 203, 255, 0.1) 0%, rgba(173, 207, 249, 0.1) 30%, rgba(206, 169, 255, 0.1) 65%, rgba(124, 208, 255, 0.1) 100%);
  --bg-canvas-intense: linear-gradient(135deg, rgba(174, 203, 255, 0.3) 0%, rgba(173, 207, 249, 0.3) 30%, rgba(206, 169, 255, 0.3) 65%, rgba(124, 208, 255, 0.3) 100%);
  
  --bg-white-soft: rgba(255,255,255,0.6);

  --border: #e8eaed;
  --border-mid: #d8dade;
  --border-radius: 16px;

  --text: #1a1c1f;
  --text-dim: #555860;
  --text-faint: #9ea3aa;

  --accent: #006AFF;
  --accent-dark: #0055CC;
  --accent-soft: rgba(0, 106, 255, 0.10);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.15);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06);

  --radius: 8px;
  --radius-lg: 12px;
  --font: 'Lato', 'Helvetica Neue', Arial, sans-serif;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }


.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border: none;
  border-radius: 20px;
  background-image: linear-gradient(134deg, #008AFF 0%, #0056FF 100%);
  color: #fff;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.20);
  transition: opacity 0.15s;
}


.btn:hover { opacity: 0.85; }

.btn.outline {
  background: var(--bg-white);
  background-image: none;
  color: var(--text-dim);
  box-shadow: var(--shadow-md);
}
.btn.outline:hover {
  opacity: 1;
  box-shadow: var(--shadow-lg);
  color: var(--accent);
}


/* ============================================================
   Login
   ============================================================ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-canvas);
}

.login-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  width: 320px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.login-logo { margin-bottom: 8px; }

.login-card h1 {
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.02em;
}

.login-card p {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.btn-google {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 6px;
  border: 1px solid var(--border-mid);
  background: var(--bg-white);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s;
  width: 100%;
  justify-content: center;
}
.btn-google:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.login-note {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
}

/* ============================================================
   App shell
   ============================================================ */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   Nav
   ============================================================ */
.nav {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 30px;
  gap: 12px;
  flex-shrink: 0;
  z-index: 100;
}

.nav-left { display: flex; align-items: center; gap: 8px; position: relative; }

.nav-logo {
  display: flex;
  align-items: center;
  padding: 6px 10px;
}

.nav-chevron {
  transition: transform 0.2s;
}

.nld-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: 14px;
  font-weight: 400;
  padding: 5px 20px;
  text-align: left;
  transition: background 0.1s;
  font-family: var(--font);
}
.nld-item:hover { background: rgba(255,255,255,0.12); }
.nld-item--icon {   padding: 7px 20px; }
.nld-item[hidden] { display: none; }

.nld-sep {
  height: 1px;
  background: rgba(255,255,255,0.2);
  margin: 6px 0;
}


.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.nav-user-name {
  font-size: 13px;
  color: var(--text-dim);
}

.nav-avatar-wrap { position: relative; }

.nav-avatar {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.nav-avatar .nav-avatar-hover { display: none; }
.nav-avatar:hover .nav-avatar-default { display: none; }
.nav-avatar:hover .nav-avatar-hover { display: block; }
.nav-avatar.open .nav-avatar-default { display: none; }
.nav-avatar.open .nav-avatar-hover { display: block; }

/* Account dropdown — anchored under the avatar */
.account-menu-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 160px;
  background: linear-gradient(160deg, #4a8aff 0%, #2d6be4 100%);
  border-radius: var(--border-radius);
  padding: 10px 0;
  box-shadow: 0 8px 32px rgba(0, 80, 200, 0.28), 0 2px 8px rgba(0,0,0,0.12);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.15s, transform 0.15s;
}
.account-menu-dropdown.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ============================================================
   Venue header
   ============================================================ */
.venue-header {
  height: var(--venue-h);
  background: var(--bg-white-soft);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0px;
  gap: 14px;
  flex-shrink: 0;
  margin: 0 20px;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  box-shadow: var(--shadow-sm);
  position:relative;
  z-index: 21;
}

.venue-header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: none;
  border: none;
  border-right: 1px solid var(--border-mid);
  cursor: pointer;
  color: var(--text);
  padding: 0 15px;
  height: 100%;
  transition: background 0.12s, color 0.12s;
   border-radius: var(--border-radius) 0 0 0;
}
.venue-header-icon:hover { background: var(--bg); }
.venue-header-icon.open {
  background: var(--accent);
  color: #fff;
}
.venue-header-icon.open svg:first-child { filter: brightness(0) invert(1); }
.venue-header-icon.open .nav-chevron { transform: rotate(180deg); }

/* Main menu dropdown — anchored under the seatmap icon */
.main-menu-dropdown {
  position: absolute;
  top: calc(100% - 4px);
  left: 0;
  min-width: 220px;
  background: linear-gradient(160deg, #4a8aff 0%, #2d6be4 100%);
  border-radius: var(--border-radius);
  padding: 10px 0;
  box-shadow: 0 8px 32px rgba(0, 80, 200, 0.28), 0 2px 8px rgba(0,0,0,0.12);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.15s, transform 0.15s;
}
.main-menu-dropdown.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.venue-header-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.venue-header-name.is-new {
  font-weight: 400;
  font-style: italic;
  color: var(--text-dim);
}

.venue-save-btn { margin-left: 6px; }
.venue-save-btn.hidden { display: none; }


/* ============================================================
   Editor layout
   ============================================================ */
.editor-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
  margin:0 20px;
  box-shadow: var(--shadow-sm);
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* ============================================================
   Tools panel — floating glass pill over canvas
   ============================================================ */
.tools-panel {
  position: absolute;
  left: 10px;
  top: 10px;
  /* transform: translateY(-50%); */
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 6px;
  gap: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px) saturate(1.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 24px rgba(0,0,0,0.09), 0 1px 3px rgba(0,0,0,0.06);
}

.tool-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.tool-btn svg {
  width: 19px;
  height: 19px;
}
.tool-btn:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}
.tool-btn.active {
  background: var(--accent);
  color: #fff;
  &:hover { background: var(--accent);  color: #fff; }
}
.tool-btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.tool-divider {
  width: 28px;
  height: 1px;
  background: rgba(0, 0, 0, 0.1);
  margin: 4px 0;
  flex-shrink: 0;
}

/* ============================================================
   Canvas area
   ============================================================ */
.canvas-area {
  flex: 1;
  background: var(--bg-canvas);
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.canvas-dots {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.canvas-viewport {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgb(255 255 255 / 0.2);
}

#svg-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  user-select: none;
}

.canvas-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  user-select: none;
  text-align: center;
}

.canvas-empty h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-dim);
  letter-spacing: -0.02em;
}

.canvas-empty p {
  font-size: 13px;
  color: var(--text-faint);
}

.canvas-viewport.drag-over .canvas-empty h2,
.canvas-viewport.drag-over .canvas-empty p {
  color: var(--accent);
}

#seatmap-svg {
  display: block;
  border-radius: 24px;
  overflow: visible;
  /* cursor: grab; */
}
/* #seatmap-svg:active { cursor: grabbing; } */

/* ============================================================
   Right panel
   ============================================================ */
.right-panel {
  width: var(--right-panel-w);
  background: var(--bg-white-soft);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.panel-section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 52px;
}

/* Layers panel fills all space when Properties is hidden */
#panel-section-layers { flex: 1; }

/* When Properties is visible, layers reverts to its stored height (set by JS) */
.right-panel.split #panel-section-layers { flex: none; }

/* Properties panel always takes remaining space below the handle */
#panel-section-properties { flex: 1; }

.panel-heading {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--border);
}

.panel-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 18px 16px;
}

.panel-empty {
  font-size: 12px;
  color: var(--text-faint);
}

.panel-resize {
  flex-shrink: 0;
  height: 5px;
  background: var(--border);
  cursor: ns-resize;
  transition: background 0.12s;
  position: relative;
}
.panel-resize::after {
  content: '';
  position: absolute;
  inset: -4px 0;
}
.panel-resize:hover { background: var(--border-mid); }
.panel-resize.is-dragging { background: var(--accent); }

/* ============================================================
   Layers panel tree
   ============================================================ */
.layer-group { margin-bottom: 2px; }

.layer-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  cursor: pointer;
  user-select: none;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
}
.layer-group-header:hover { color: var(--text); }

.layer-chevron {
  flex-shrink: 0;
  transition: transform 0.15s;
  color: var(--text-faint);
  transform: rotate(-90deg); /* icon points down; -90° → points right (collapsed) */
}
.layer-chevron.open { transform: rotate(0deg); } /* expanded → points down */

.layer-group-label { flex: 1; }

.layer-group-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  background: var(--bg);
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 20px;
  text-align: center;
}

.layer-group-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 4px;
}
.layer-group-body.collapsed { display: none; }

.layer-sub-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 4px;
  cursor: pointer;
  user-select: none;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
}
.layer-sub-group-header:hover { color: var(--text); background: var(--bg); }
.layer-sub-group-header .layer-item-label { flex: 1; }
.layer-sub-group-header.active {
  background: var(--accent-dark);
  color: var(--color-white);
  font-weight: 700;
}
.layer-sub-group-header.active:hover { background: var(--accent); color: var(--color-white); }
.layer-sub-group-header.depth-1 { padding-left: 20px; font-size: 10px; color: var(--text-faint); }
.layer-sub-group-header.depth-1:hover { color: var(--text-dim); }

.layer-item {
  padding: 3px 6px 3px 16px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.layer-item:hover { background: var(--bg); color: var(--text); }
.layer-item.depth-1 { padding-left: 28px; color: var(--text-faint); }
.layer-item.depth-1:hover { color: var(--text-dim); }
.layer-item.depth-2 { padding-left: 40px; color: var(--text-faint); }
.layer-item.depth-2:hover { color: var(--text-dim); }
.layer-item.active {
  background: var(--accent-dark);
  color: var(--color-white);
  font-weight: 700;
  border-radius: var(--radius);
  font-weight: 700;
}
.layer-item.active:hover {

  background : var(--accent);
    color: var(--color-white);
}

/* --- Layers drag-reorder (Slice A) --- */
.layer-draggable { position: relative; }
.layer-draggable:hover { cursor: grab; }
.dnd-dragging { opacity: 0.4; cursor: grabbing; }
/* Insertion line shown on the hovered target row while dragging. */
.dnd-over-top::before,
.dnd-over-bottom::after {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  pointer-events: none;
}
.dnd-over-top::before { top: -1px; }
.dnd-over-bottom::after { bottom: -1px; }

/* Per-section block wraps a section header + its Shapes/Labels subtree so the
   whole thing is one drop zone (Slice C). */
.layer-section-block {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* Cross-group drop target (Slice C) — drop a leaf INTO this container */
.dnd-into {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 4px;
  background: var(--accent-soft);
}

/* Inline rename input (double-click a row) */
.layer-rename-input {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 11px;
  padding: 1px 4px;
  margin: -2px 0;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--bg-elevated, #fff);
  color: var(--text);
  outline: none;
}

/* ============================================================
   Properties inspector (right panel)
   ============================================================ */
.prop-group {
  margin-bottom: 12px;
}

.prop-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.prop-readonly {
  font-size: 12px;
  color: var(--text-faint);
  font-family: monospace;
  padding: 4px 0;
}

.prop-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 8px;
  outline: none;
  transition: border-color 0.12s;
}
.prop-input:focus {
  border-color: var(--accent);
}

.prop-textarea {
  resize: none;
  overflow: hidden;
  min-height: 28px;
  line-height: 1.4;
}

.prop-hint {
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 3px;
  line-height: 1.4;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  /* height: var(--footer-h);
  border-top: 1px solid var(--border); */
  display: flex;
  align-items: center;
  /* justify-content: space-between; */
  padding: 15px 30px;
  flex-shrink: 0;
  gap: 10px;
}

.footer-copy {
  font-size: 11px;
  color: var(--text-faint);
}

.footer-version {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
}

.footer-shortcuts-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--text-faint);
}

/* ============================================================
   Dialogs — shared overlay
   ============================================================ */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-canvas-intense);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 1;
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

/* Zoom-fade open/close. The global `.hidden` sets display:none, which can't
   animate — so for dialog overlays we override that and drive visibility via
   opacity + a scaled dialog box instead. Both directions animate off the same
   `.hidden` toggle the JS already uses; no scripting needed. */
.dialog-overlay.hidden {
  display: flex !important; /* beat the global `.hidden { display:none !important }` */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.dialog-overlay > * {
  transform: scale(1);
  opacity: 1;
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  will-change: transform, opacity;
}
.dialog-overlay.hidden > * {
  transform: scale(0.94) translateY(8px);
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .dialog-overlay,
  .dialog-overlay > * { transition: none; }
}


/* ============================================================
   Library dialog
   ============================================================ */
/* Top-anchor the library modal so its header/toolbar stay at a fixed Y as the
   content height changes between card/table views (rather than recentring and
   dragging the controls up/down). Other modals stay centred. */
#library-overlay { align-items: flex-start; }

.library-dialog {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 820px;
  max-width: 95vw;
  max-height: 80vh;
  margin-top: 8vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.library-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.library-header h2 {
  font-size: 17px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.01em;
}

.library-header-spacer { flex: 1; }

.library-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.library-toolbar .library-search-wrap { flex: 1; }

.library-filter { display: flex; flex-direction: column; gap: 4px; }
.library-filter > span {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
}
.library-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 34px 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-mid);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background-color: var(--bg);
  /* Our own chevron (matches #icon-chevron) instead of the native OS arrow */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8' viewBox='0 0 14 8'%3E%3Cpath fill='%239ea3aa' fill-rule='evenodd' d='M5.975 4.505A558.797 558.797 0 0 0 1.749.3a1.03 1.03 0 0 0-1.45 0A1.017 1.017 0 0 0 .3 1.742l5.8 5.774c.751.642 1.05.649 1.802 0L13.7 1.742a1.016 1.016 0 0 0 0-1.443 1.03 1.03 0 0 0-1.45 0c-2.232 2.25-3.64 3.652-4.224 4.206-.875.832-1.157.91-2.05 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 11px 7px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.12s;
}
.library-select:focus { border-color: var(--accent); }
.library-clear-btn { align-self: flex-end; }

.library-search {
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-mid);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.12s;
}
.library-search:focus { border-color: var(--accent); }

.dialog-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
}
.dialog-close-btn:hover { background: var(--bg);  box-shadow: var(--shadow-md);}

.library-grid {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  align-content: start;
}

.library-loading {
  grid-column: 1/-1;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  padding: 40px 0;
}

.library-empty {
  grid-column: 1/-1;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  padding: 40px 0;
}

.map-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: clip;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
  background: var(--bg-white);
}
.map-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.map-card-preview {
  height: 140px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px;
}

.map-card-preview svg {
  max-width: 100%;
  max-height: 100%;
}

.map-card-info {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

.map-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-card-meta {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
}

.map-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.map-card-btn {
  flex: 1;
  padding: 6px 10px;

  justify-content: center;
  font-size: 11px;
}
.map-card-btn--delete {
  flex: 0 0 auto;
  width: 30px;
  padding: 5px;

  color: var(--text-faint);
}
.map-card-btn--delete:hover {
  opacity: 1;
  border-color: #e53e3e;
  color: #e53e3e;
}

/* ============================================================
   Save dialog
   ============================================================ */
.save-dialog {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 400px;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.save-dialog h2 {
  font-size: 18px;
  font-weight: 900;
  color: var(--text);
}

.save-dialog p {
  font-size: 13px;
  color: var(--text-dim);
}

.save-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-mid);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.12s;
}
.save-input:focus { border-color: var(--accent); }
.save-input.is-locked { background: var(--bg); color: var(--text-dim); cursor: not-allowed; }

.save-field { display: flex; flex-direction: column; gap: 5px; }
.save-field > span {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
}
.save-field-hint { font-size: 11px; color: var(--text-faint); }

/* ============================================================
   Venue groups (library) + Manage venues dialog
   ============================================================ */
.venue-group { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 12px; }
.venue-group + .venue-group { margin-top: 4px; padding-top: 20px; border-top: 1px solid var(--border); }
.venue-group-header { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.venue-group-name { font-size: 15px; font-weight: 900; color: var(--text); }
.venue-group-location { font-size: 12px; color: var(--text-faint); }
.venue-group-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  align-content: start;
}

/* View toggle (segmented control in the library header) */
.library-view-toggle {
  display: flex;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.library-view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 30px;
  border: none;
  background: var(--bg-white);
  color: var(--text-faint);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.library-view-btn:hover { color: var(--text); }
.library-view-btn.is-active { background: var(--accent); color: #fff; }

/* Manage venues — circular accent-gear icon button */
.library-settings-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--bg-white);
  color: var(--accent);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.library-settings-btn:hover {
  box-shadow: var(--shadow-lg);
  transform: rotate(30deg);
}

/* Table view */
.library-grid--table {
  display: block;
  padding: 0px;
}
.venue-group--table {
  grid-column: auto;
  gap: 0;
}
.venue-group--table + .venue-group--table { margin-top: 0; padding-top: 0; border-top: none; }

.venue-group-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 10px 26px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
}
.venue-group-row:hover { background: var(--bg); }
.venue-group-row .layer-chevron { align-self: center; }
.venue-group-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-faint);
}

.library-table { display: flex; flex-direction: column; }
.library-table-row {
  display: grid;
  grid-template-columns: 56px 1fr auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 6px 26px 6px 46px;
  border-bottom: 1px solid var(--border);
}
.library-table-row:hover { background: var(--bg); }
.library-table-thumb {
  width: 56px;
  height: 38px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.library-table-thumb svg { max-width: 100%; max-height: 100%; }
.library-table-variant {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.library-table-meta { font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.library-table-actions { display: flex; gap: 6px; }
.library-table-actions .map-card-btn { flex: 0 0 auto; }

.venues-dialog { width: 560px; max-height: 80vh; overflow: hidden; }
.venues-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
/* min-height:0 lets the list actually scroll inside the flex-column dialog
   instead of pushing past its max-height. */
.venues-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; min-height: 0; }
.venue-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 8px;
  align-items: center;
}
.venue-row-count { font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.venue-row-save { padding: 8px 14px; font-size: 12px; }

.save-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================================
   Import preview dialog
   ============================================================ */
.import-dialog {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(1080px, 94vw);
  height: min(760px, 92vh);
  padding: 22px 26px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.import-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.import-header h2 { font-size: 18px; font-weight: 900; color: var(--text); }
.import-body {
  flex: 1;
  display: flex;
  gap: 18px;
  min-height: 0;
}
.import-panes {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  min-width: 0;
}
.import-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.import-pane-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.import-pane-svg {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background:
    linear-gradient(45deg, #fafbfc 25%, transparent 25%) -8px 0,
    linear-gradient(-45deg, #fafbfc 25%, transparent 25%) -8px 0,
    linear-gradient(45deg, transparent 75%, #fafbfc 75%),
    linear-gradient(-45deg, transparent 75%, #fafbfc 75%);
  background-size: 16px 16px;
  background-color: #fff;
  min-height: 0;
}
.import-pane-svg svg { max-width: 100%; max-height: 100%; }
.import-validation {
  width: 300px;
  flex-shrink: 0;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 12.5px;
}
.import-val-group { margin-bottom: 14px; }
.import-val-group:last-child { margin-bottom: 0; }
.import-val-title {
  font-weight: 800;
  font-size: 12px;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.import-val-count {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-dim);
}
.import-val-list { list-style: none; margin: 0; padding: 0; }
.import-val-list li {
  padding: 3px 0;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  word-break: break-word;
}
.import-val-list li:last-child { border-bottom: none; }
.import-val-ok { color: #1f9d55; font-weight: 700; }
.import-val-block {
  color: #c0392b;
  font-weight: 700;
  background: rgba(192,57,43,0.07);
  padding: 10px 12px;
  border-radius: var(--radius);
}
.import-val-warn .import-val-count { background: rgba(214,158,46,0.18); color: #9c6f15; }
.import-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.import-actions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* needs-review badge in the layers panel */
.layer-item.has-badge { display: flex; align-items: center; gap: 6px; }
.layer-item.has-badge .layer-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.layer-item-review-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #9c6f15;
  background: rgba(214,158,46,0.18);
  padding: 1px 5px;
  border-radius: 7px;
  flex-shrink: 0;
}


/* ============================================================
   Small screen
   ============================================================ */
.screen-too-small { display: none; }

@media (max-width: 767px) {
  .screen-too-small {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg-canvas);
    align-items: center;
    justify-content: center;
    padding: 32px;
  }

  .screen-too-small-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    max-width: 320px;
  }

  .screen-too-small-emoji {
    font-size: 120px;
    line-height: 1;
  }

  .screen-too-small-content h2 {
    font-size: 20px;
    font-weight: 900;
    color: var(--text);
    letter-spacing: -0.02em;
  }

  .screen-too-small-content p {
    font-size: 14px;
    color: var(--text-dim);
    line-height: 1.6;
  }

  body > *:not(.screen-too-small) { display: none !important; }
}
