:root {
  /* Google Material 3 / Google Maps Core Design System */
  --gm-blue: #1a73e8;
  --gm-blue-hover: #1765cc;
  --gm-blue-light: #e8f0fe;
  --gm-blue-tint: #d2e3fc;

  --gm-green: #1e8e3e;
  --gm-green-hover: #188038;
  --gm-green-light: #e6f4ea;
  --gm-green-tint: #ceead6;

  --gm-red: #ea4335;
  --gm-red-hover: #d93025;
  --gm-red-light: #fce8e6;
  --gm-red-tint: #fad2cf;

  --gm-yellow: #f9ab00;
  --gm-yellow-light: #fef7e0;

  --gm-surface: #ffffff;
  --gm-surface-variant: #f8f9fa;
  --gm-surface-sunken: #f1f3f4;
  --gm-surface-hover: #f1f3f4;

  --gm-text: #202124;
  --gm-text-secondary: #5f6368;
  --gm-text-muted: #70757a;
  --gm-text-disabled: #bdc1c6;

  --gm-border: #dadce0;
  --gm-border-subtle: #e8eaed;

  /* Material Elevation Shadows */
  --gm-shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
  --gm-shadow-md: 0 2px 6px 2px rgba(60, 64, 67, 0.15), 0 1px 2px 0 rgba(60, 64, 67, 0.3);
  --gm-shadow-lg: 0 4px 12px 3px rgba(60, 64, 67, 0.15), 0 1px 3px 0 rgba(60, 64, 67, 0.3);
  --gm-shadow-sheet: 0 -4px 16px rgba(60, 64, 67, 0.15);

  --font-display: 'Google Sans', 'Google Sans Text', Roboto, 'Pretendard Variable', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'Google Sans Text', Roboto, 'Pretendard Variable', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --sheet-offset: 46dvh;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--gm-text);
  background: var(--gm-surface-variant);
  -webkit-font-smoothing: antialiased;
}

button, select, input, a {
  touch-action: manipulation;
  font-family: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f8f9fa;
}

/* ==================== GOOGLE MAPS FLOATING TOP BAR ==================== */
.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: calc(var(--safe-top) + 12px) 16px 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.75) 80%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
}

.top-bar > * {
  pointer-events: auto;
}

/* Floating Google Maps Search Pill */
.search-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--gm-surface);
  border-radius: 28px;
  height: 48px;
  padding: 4px 8px 4px 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), 0 -1px 0px rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.04);
  max-width: 780px;
  margin: 0 auto;
  transition: box-shadow 0.2s ease, background 0.2s ease;
}

.search-row:focus-within {
  box-shadow: var(--gm-shadow-lg);
  border-color: rgba(26, 115, 232, 0.2);
}

.brand-badge {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.brand-badge:hover {
  background: var(--gm-surface-hover);
}

.brand-badge:active {
  transform: scale(0.92);
}

.brand-google-pin {
  width: 20px;
  height: 26px;
  flex-shrink: 0;
}

.search-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  min-width: 0;
}

.search-icon {
  width: 18px;
  height: 18px;
  color: var(--gm-text-secondary);
  flex-shrink: 0;
  margin-right: 8px;
}

.search-input-wrap input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0 4px;
  font-size: 15px;
  font-weight: 400;
  color: var(--gm-text);
  outline: none;
  font-family: var(--font-sans);
}

.search-input-wrap input::placeholder {
  color: var(--gm-text-muted);
  font-size: 14.5px;
}

.icon-btn {
  border: none;
  background: none;
  color: var(--gm-text-secondary);
  font-size: 14px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s ease;
}

.icon-btn:hover {
  background: var(--gm-surface-hover);
}

.search-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.search-divider {
  width: 1px;
  height: 24px;
  background: var(--gm-border);
  margin: 0 2px;
  flex-shrink: 0;
}

/* Google Sheets Sync Pill */
.action-pill {
  height: 32px;
  padding: 0 10px;
  border-radius: 16px;
  border: 1px solid var(--gm-border);
  background: var(--gm-surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--gm-text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.action-pill:hover {
  background: var(--gm-surface-hover);
  border-color: var(--gm-text-muted);
}

@media (max-width: 480px) {
  .action-pill {
    padding: 0 8px;
  }
  .action-pill .sync-label {
    display: none;
  }
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online {
  background: var(--gm-green);
  box-shadow: 0 0 0 3px rgba(30, 142, 62, 0.2);
}

.status-dot.offline {
  background: var(--gm-red);
}

/* Google Account Style Circle Profile / Settings Button */
.icon-circle-btn,
.profile-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--gm-surface-sunken);
  color: var(--gm-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-circle-btn:hover,
.profile-btn:hover {
  background: var(--gm-border-subtle);
  color: var(--gm-text);
}

.icon-circle-btn:active,
.profile-btn:active {
  transform: scale(0.94);
}

/* Google Account Profile Avatar & Live Sync Ring */
.profile-avatar-btn {
  padding: 0;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
}

.avatar-badge-wrap {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e8f0fe;
  color: var(--gm-blue);
  border-radius: 50%;
  font-weight: 700;
  font-size: 13.5px;
  border: 1.5px solid rgba(26, 115, 232, 0.25);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.profile-avatar-btn:hover .avatar-badge-wrap {
  box-shadow: var(--gm-shadow-sm);
  transform: scale(1.04);
}

.avatar-initial {
  line-height: 1;
}

.avatar-status-ring {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  transition: background-color 0.2s ease;
}

.avatar-status-ring.online {
  background-color: var(--gm-green);
}

.avatar-status-ring.cached {
  background-color: var(--gm-yellow);
}

.avatar-status-ring.offline {
  background-color: #dadce0;
}

/* ==================== UNIFIED GOOGLE MAPS FILTER RIBBON ==================== */
.top-bar.collapsed .filter-ribbon,
.top-bar.collapsed .filter-scroll,
.top-bar.collapsed .subfilter-scroll {
  display: none;
}

.filter-ribbon {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 4px 4px;
  scrollbar-width: none;
  max-width: 780px;
  margin: 0 auto;
  -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 36px), transparent 100%);
  mask-image: linear-gradient(to right, black calc(100% - 36px), transparent 100%);
}
.filter-ribbon::-webkit-scrollbar { display: none; }

.filter-scroll,
.subfilter-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 0;
  margin: 0;
}

.filter-chip {
  border: 1px solid var(--gm-border);
  background: var(--gm-surface);
  color: var(--gm-text);
  padding: 5px 12px;
  min-height: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.15);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.filter-chip:hover {
  background: var(--gm-surface-variant);
}

.chip-glyph {
  font-size: 12px;
  margin-right: 2px;
  line-height: 1;
}

.filter-chip.active {
  background: var(--gm-blue-light);
  color: var(--gm-blue);
  border-color: var(--gm-blue);
  font-weight: 600;
}

.filter-chip.status-again.active {
  background: var(--gm-green-light);
  border-color: var(--gm-green);
  color: var(--gm-green);
  font-weight: 600;
}

.filter-chip.status-unvisited.active {
  background: var(--gm-blue-light);
  border-color: var(--gm-blue);
  color: var(--gm-blue);
  font-weight: 600;
}

.filter-chip.status-no.active {
  background: var(--gm-surface-sunken);
  border-color: var(--gm-text-muted);
  color: var(--gm-text-secondary);
  font-weight: 600;
}

.chip-count {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--gm-surface-sunken);
  color: var(--gm-text-secondary);
}

.filter-chip.active .chip-count {
  background: rgba(26, 115, 232, 0.15);
  color: var(--gm-blue);
}

.filter-chip.status-again.active .chip-count {
  background: rgba(30, 142, 62, 0.18);
  color: var(--gm-green);
}

.filter-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--gm-surface);
  border: 1px solid var(--gm-border);
  border-radius: 8px;
  min-height: 32px;
  height: 32px;
  padding: 4px 26px 4px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gm-text);
  max-width: 170px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.12);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.filter-select:hover {
  border-color: var(--gm-text-muted);
}

.filter-select.is-active {
  background-color: var(--gm-blue-light);
  color: var(--gm-blue);
  border-color: var(--gm-blue);
  font-weight: 600;
}

.reset-filter-btn {
  border: 1px solid var(--gm-blue);
  background: var(--gm-blue-light);
  color: var(--gm-blue);
  border-radius: 8px;
  min-height: 32px;
  height: 32px;
  padding: 4px 12px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease;
}

.reset-filter-btn:hover {
  background: var(--gm-blue-tint);
}

/* ==================== MAP CANVAS & GOOGLE MAPS PINS ==================== */
.map-area {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
}

.map-canvas {
  width: 100%;
  height: 100%;
  /* Crisp, authentic cartography without tint */
}

/* Google Maps Floating Action Buttons (FABs) */
.map-floating-controls {
  position: absolute;
  right: 16px;
  bottom: calc(var(--sheet-offset, 46dvh) + 16px);
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: bottom 0.25s cubic-bezier(0.2, 0, 0, 1), opacity 0.2s ease;
}

.fab-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: var(--gm-surface);
  color: var(--gm-text-secondary);
  box-shadow: var(--gm-shadow-md);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.fab-btn:hover {
  background: var(--gm-surface-variant);
  color: var(--gm-text);
  box-shadow: var(--gm-shadow-lg);
}

.fab-btn:active {
  transform: scale(0.94);
}

#btnMyLocation {
  color: var(--gm-blue);
}

.fab-btn.primary,
.fab-btn.primary.m3-fab {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--gm-blue);
  color: #ffffff;
  border: none;
  font-size: 24px;
  font-weight: 400;
  box-shadow: 0 4px 8px 3px rgba(60, 64, 67, 0.15), 0 1px 3px rgba(60, 64, 67, 0.3);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.fab-btn.primary:hover,
.fab-btn.primary.m3-fab:hover {
  background: var(--gm-blue-hover);
  box-shadow: 0 6px 12px 4px rgba(60, 64, 67, 0.2);
  transform: scale(1.02);
}

.fab-btn.primary:active,
.fab-btn.primary.m3-fab:active {
  transform: scale(0.96);
}

.map-toast {
  position: absolute;
  top: calc(var(--top-h, 150px) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 850;
  background: #323232;
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--gm-shadow-lg);
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== GOOGLE MAPS TEARDROP MARKERS ==================== */
.matzip-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -100%);
  cursor: pointer;
  user-select: none;
  transition: transform 0.16s cubic-bezier(0.2, 0, 0, 1);
  will-change: transform;
}

.matzip-pin:hover,
.matzip-pin:focus {
  transform: translate(-50%, -100%) scale(1.16);
  z-index: 9999 !important;
}

.matzip-pin.is-selected {
  transform: translate(-50%, -100%) scale(1.25) !important;
  z-index: 10000 !important;
}

.matzip-pin.is-selected .pin-seal {
  box-shadow: 0 0 0 3.5px #ffffff, 0 0 0 7.5px rgba(26, 115, 232, 0.55), 0 6px 14px rgba(0, 0, 0, 0.4);
  animation: pinPulse 1.8s infinite ease-in-out;
}

.matzip-pin.pin-again.is-selected .pin-seal {
  box-shadow: 0 0 0 3.5px #ffffff, 0 0 0 7.5px rgba(30, 142, 62, 0.55), 0 6px 14px rgba(0, 0, 0, 0.4);
  animation: pinPulseAgain 1.8s infinite ease-in-out;
}

@keyframes pinPulse {
  0%, 100% {
    box-shadow: 0 0 0 3.5px #ffffff, 0 0 0 7px rgba(26, 115, 232, 0.55), 0 4px 12px rgba(0, 0, 0, 0.35);
  }
  50% {
    box-shadow: 0 0 0 3.5px #ffffff, 0 0 0 13px rgba(26, 115, 232, 0.15), 0 6px 16px rgba(0, 0, 0, 0.4);
  }
}

@keyframes pinPulseAgain {
  0%, 100% {
    box-shadow: 0 0 0 3.5px #ffffff, 0 0 0 7px rgba(30, 142, 62, 0.55), 0 4px 12px rgba(0, 0, 0, 0.35);
  }
  50% {
    box-shadow: 0 0 0 3.5px #ffffff, 0 0 0 13px rgba(30, 142, 62, 0.15), 0 6px 16px rgba(0, 0, 0, 0.4);
  }
}

/* Iconic Teardrop Pin Shape */
.matzip-pin .pin-seal {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  line-height: 1;
  color: #ffffff;
  border: 1.5px solid #ffffff;
  background: var(--gm-blue);
}

.matzip-pin .pin-seal > * {
  transform: rotate(45deg);
  display: inline-block;
}

/* Pin Color Variations */
.matzip-pin.pin-again .pin-seal {
  background: var(--gm-green); /* 또 갈 집: Google Maps Saved Green */
}

.matzip-pin.pin-unvisited .pin-seal {
  background: var(--gm-blue); /* 가볼 곳: Google Maps Blue */
}

.matzip-pin.pin-no .pin-seal {
  background: var(--gm-text-muted); /* 보류: Neutral Gray */
}

.matzip-pin.pin-visited .pin-seal {
  background: var(--gm-yellow);
}

/* Google Maps POI Label Capsule */
.matzip-pin .pin-label {
  margin-top: 3px;
  padding: 2px 7px;
  background: #ffffff;
  color: var(--gm-text);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
  white-space: nowrap;
  box-shadow: var(--gm-shadow-sm);
  border: 1px solid rgba(0, 0, 0, 0.08);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

/* User Location Blue Beacon */
.gps-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #4285f4;
  border: 2.5px solid #ffffff;
  box-shadow: 0 0 0 6px rgba(66, 133, 244, 0.28), 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* ==================== GOOGLE MAPS BOTTOM SHEET (EXPLORE DRAWER) ==================== */
.bottom-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  background: var(--gm-surface);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--gm-shadow-sheet);
  display: flex;
  flex-direction: column;
  transition: height 0.26s cubic-bezier(0.2, 0, 0, 1);
  padding-bottom: var(--safe-bottom);
}

.bottom-sheet.state-map {
  height: calc(76px + var(--safe-bottom));
}

.bottom-sheet.state-split {
  height: 46dvh;
}

.bottom-sheet.state-list {
  height: calc(100dvh - var(--top-h, 140px));
}

.app-shell.sheet-dragging .bottom-sheet,
.app-shell.sheet-dragging .map-floating-controls {
  transition: none !important;
}

.sheet-handle-bar {
  padding: 10px 18px 12px;
  background: var(--gm-surface);
  border-radius: 20px 20px 0 0;
  border-bottom: 1px solid var(--gm-border-subtle);
  flex-shrink: 0;
  user-select: none;
  touch-action: none;
  cursor: grab;
}

.app-shell.sheet-dragging .sheet-handle-bar {
  cursor: grabbing;
}

.sheet-grabber {
  width: 32px;
  height: 4px;
  background: var(--gm-border);
  border-radius: 2px;
  margin: 0 auto 10px;
}

.sheet-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sheet-title-group h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--gm-text);
  letter-spacing: -0.01em;
}

.sheet-subtitle {
  font-size: 12px;
  color: var(--gm-text-secondary);
}

/* Material 3 Segmented Button */
.view-mode-segmented {
  display: inline-flex;
  background: var(--gm-surface-sunken);
  border-radius: 20px;
  padding: 2px;
  gap: 2px;
}

.seg-btn {
  border: none;
  background: transparent;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--gm-text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.seg-btn:active {
  transform: scale(0.96);
}

.seg-btn.active {
  background: var(--gm-surface);
  color: var(--gm-blue);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.2);
}

.sheet-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--gm-surface-variant);
}

/* ==================== GOOGLE MAPS STYLE PLACE CARD ==================== */
.place-card {
  background: var(--gm-surface);
  border: 1px solid var(--gm-border-subtle);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.place-card:hover {
  box-shadow: var(--gm-shadow-md);
  border-color: var(--gm-border);
}

.place-card:active {
  transform: scale(0.99);
}

.place-card.status-card-again {
  border-left: 4px solid var(--gm-green);
}
.place-card.status-card-unvisited {
  border-left: 4px solid var(--gm-blue);
}
.place-card.status-card-no {
  border-left: 4px solid var(--gm-text-muted);
}

.place-card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.place-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.place-title-wrap {
  flex: 1;
  min-width: 0;
}

.category-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--gm-surface-sunken);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  border: 1px solid var(--gm-border-subtle);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
}

.avatar-glyph {
  line-height: 1;
}

.place-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--gm-text);
  margin: 0;
  line-height: 1.3;
}

.place-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.badge-pill {
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--gm-surface-sunken);
  color: var(--gm-text-secondary);
}

.badge-pill.status-tag-again {
  background: var(--gm-green-light);
  color: var(--gm-green);
  border: 1px solid var(--gm-green-tint);
  font-weight: 600;
}

.badge-pill.status-tag-unvisited {
  background: var(--gm-blue-light);
  color: var(--gm-blue);
  border: 1px solid var(--gm-blue-tint);
  font-weight: 600;
}

.badge-pill.status-tag-no {
  background: var(--gm-surface-sunken);
  color: var(--gm-text-secondary);
  border: 1px solid var(--gm-border-subtle);
  font-weight: 600;
}

.badge-glyph {
  font-size: 11px;
  line-height: 1;
  margin-right: 2px;
}

.badge-area {
  background: var(--gm-blue-light);
  color: var(--gm-blue);
}

.place-meta {
  font-size: 13px;
  color: var(--gm-text-secondary);
  margin: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-note {
  font-size: 12.5px;
  color: var(--gm-text);
  background: var(--gm-surface-sunken);
  border-radius: 6px;
  padding: 6px 10px;
  margin-top: 6px;
  line-height: 1.45;
  max-width: 65ch;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card Status Badge Column */
.place-status-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding-left: 12px;
  border-left: 1px solid var(--gm-border-subtle);
  flex-shrink: 0;
  min-width: 60px;
}

.card-stamp {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  padding: 4px;
  border: 1px solid var(--gm-border-subtle);
  background: var(--gm-surface-sunken);
  color: var(--gm-text-secondary);
}

.card-stamp .stamp-hanja {
  font-size: 15px;
  line-height: 1;
}

.card-stamp .stamp-kor {
  font-size: 11px;
  font-weight: 700;
  margin-top: 3px;
}

.card-stamp.stamp-again {
  border-color: var(--gm-green-tint);
  background: var(--gm-green-light);
  color: var(--gm-green);
}

.card-stamp.stamp-unvisited {
  border-color: var(--gm-blue-tint);
  background: var(--gm-blue-light);
  color: var(--gm-blue);
}

.card-stamp.stamp-no {
  border-color: var(--gm-border);
  background: var(--gm-surface-sunken);
  color: var(--gm-text-muted);
}

.visit-date-label {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--gm-text-muted);
  margin-top: 6px;
}

.place-card-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--gm-border-subtle);
}

.card-nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-nav-link {
  font-size: 12px;
  font-weight: 500;
  min-height: 30px;
  padding: 3px 10px;
  border-radius: 15px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  background: var(--gm-surface);
  border: 1px solid var(--gm-border);
  color: var(--gm-blue);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.card-nav-link:hover {
  background: var(--gm-blue-light);
  border-color: var(--gm-blue);
}

.card-nav-link:active {
  transform: scale(0.96);
}

.card-nav-link.kakao {
  color: #371d1e;
  border-color: #f7e600;
  background: #fae100;
}

.card-nav-link.naver {
  color: #03cf5d;
  border-color: rgba(3, 207, 93, 0.4);
  background: #eefbf4;
}

.card-nav-link.btn-copy-addr {
  cursor: pointer;
  background: var(--gm-surface);
  color: var(--gm-text-secondary);
  border: 1px solid var(--gm-border);
  gap: 4px;
}

.card-nav-link.btn-copy-addr:hover {
  background: var(--gm-surface-variant);
  color: var(--gm-text);
  border-color: var(--gm-text-muted);
}

.card-open-hint {
  font-size: 12px;
  color: var(--gm-text-secondary);
  font-weight: 500;
}

/* ==================== GOOGLE MAPS PLACE DETAIL & CHECK-IN MODAL ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  transition: opacity 0.2s ease;
}

.modal-card {
  pointer-events: auto;
  width: 100%;
  max-width: 600px;
  height: 75dvh;
  max-height: 92dvh;
  background: var(--gm-surface);
  border-radius: 20px 20px 0 0;
  padding: 0 20px calc(var(--safe-bottom) + 20px);
  overflow-y: auto;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.24s cubic-bezier(0.2, 0, 0, 1);
}

.modal-grabber {
  position: sticky;
  top: 0;
  z-index: 11;
  width: 100%;
  padding: 10px 0 8px;
  background: var(--gm-surface);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.modal-grabber::before {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  background: var(--gm-border);
  border-radius: 2px;
  margin: 0 auto;
}

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

.modal-header {
  position: sticky;
  top: 22px;
  z-index: 10;
  background: var(--gm-surface);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--gm-border-subtle);
}

.modal-title,
.detail-title {
  margin: 4px 0 2px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--gm-text);
  line-height: 1.25;
}

.detail-sub {
  margin: 0;
  font-size: 13.5px;
  color: var(--gm-text-secondary);
}

/* Google Maps Action Bar (Directions / Map Links) */
.nav-shortcuts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

@media (max-width: 420px) {
  .nav-shortcuts {
    grid-template-columns: repeat(2, 1fr);
  }
}

.nav-btn {
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 20px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--gm-border);
  color: var(--gm-text);
  background: var(--gm-surface);
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.1);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.nav-btn:hover {
  background: var(--gm-surface-variant);
}

.nav-btn:active {
  transform: scale(0.97);
}

.nav-btn.kakao { background: #fee500; border-color: #e5cd00; color: #191919; font-weight: 600; }
.nav-btn.naver { background: #03cf5d; border-color: #02b350; color: #ffffff; font-weight: 600; }
.nav-btn.google { background: var(--gm-blue); border-color: var(--gm-blue); color: #ffffff; font-weight: 600; }
.nav-btn.copy { background: var(--gm-surface); border-color: var(--gm-border); color: var(--gm-text); font-weight: 600; cursor: pointer; }
.nav-btn.copy:hover { background: var(--gm-surface-variant); }

/* Google Maps Visit Tracker Card */
.visit-tracker-box {
  background: var(--gm-surface-variant);
  border: 1px solid var(--gm-border-subtle);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.section-heading {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--gm-text);
  margin-bottom: 10px;
}

.visit-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.visit-choice-btn {
  border: 1px solid var(--gm-border);
  background: var(--gm-surface);
  border-radius: 10px;
  min-height: 84px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.visit-choice-btn:hover {
  border-color: var(--gm-blue);
}

.stamp-seal {
  font-size: 16px;
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--gm-text-secondary);
  margin-bottom: 2px;
}

.choice-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--gm-text);
}

.choice-desc {
  font-size: 11px;
  color: var(--gm-text-muted);
}

.visit-choice-btn.selected[data-choice="again"] {
  border: 2px solid var(--gm-green);
  background: var(--gm-green-light);
}
.visit-choice-btn.selected[data-choice="again"] .choice-title {
  color: var(--gm-green);
}

.visit-choice-btn.selected[data-choice="no"] {
  border: 2px solid var(--gm-text-muted);
  background: var(--gm-surface-sunken);
}

.visit-choice-btn.selected[data-choice="unvisited"] {
  border: 2px solid var(--gm-blue);
  background: var(--gm-blue-light);
}
.visit-choice-btn.selected[data-choice="unvisited"] .choice-title {
  color: var(--gm-blue);
}

.visit-fields-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

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

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gm-text-secondary);
}

.field-group input,
.field-group select {
  height: 42px;
  border: 1px solid var(--gm-border);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14.5px;
  background: var(--gm-surface);
  color: var(--gm-text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-group input:focus,
.field-group select:focus {
  border-color: var(--gm-blue);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.date-input-row {
  display: flex;
  gap: 8px;
}
.date-input-row input { flex: 1; }

.small-btn {
  border: 1px solid var(--gm-border);
  background: var(--gm-surface);
  color: var(--gm-text);
  border-radius: 8px;
  min-height: 42px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.small-btn:hover {
  background: var(--gm-surface-sunken);
}

/* Google Blue Primary Button */
.primary-save-btn {
  width: 100%;
  min-height: 44px;
  border: none;
  border-radius: 22px;
  background: var(--gm-blue);
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.primary-save-btn:hover {
  background: var(--gm-blue-hover);
  box-shadow: var(--gm-shadow-md);
}

.primary-save-btn:active {
  transform: scale(0.98);
}

.primary-save-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.secondary-btn {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--gm-border);
  border-radius: 21px;
  background: var(--gm-surface);
  color: var(--gm-text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s ease;
}

.secondary-btn:hover {
  background: var(--gm-surface-sunken);
  color: var(--gm-text);
}

.feedback-msg {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
.feedback-msg.success { color: var(--gm-green); }
.feedback-msg.error { color: var(--gm-red); }

/* Extra Sheet Columns Grid */
.extra-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.extra-field-item {
  background: var(--gm-surface-variant);
  border: 1px solid var(--gm-border-subtle);
  border-radius: 8px;
  padding: 8px 10px;
}
.extra-field-key {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--gm-text-muted);
  margin-bottom: 2px;
}
.extra-field-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--gm-text);
  word-break: break-word;
}
.extra-field-val a {
  color: var(--gm-blue);
  font-weight: 600;
  text-decoration: none;
}

/* Settings Blocks */
.settings-block {
  border: 1px solid var(--gm-border-subtle);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  background: var(--gm-surface-variant);
}
.settings-block h4 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--gm-text);
}
.helper-text {
  font-size: 12.5px;
  color: var(--gm-text-secondary);
  margin: 0 0 10px;
  line-height: 1.5;
  max-width: 65ch;
}
.setup-guide {
  margin-top: 8px;
  font-size: 12.5px;
  background: var(--gm-surface);
  border: 1px solid var(--gm-border-subtle);
  border-radius: 8px;
  padding: 8px 12px;
}
.setup-guide summary {
  font-weight: 600;
  cursor: pointer;
  color: var(--gm-blue);
}
.setup-guide ol {
  margin: 8px 0 4px;
  padding-left: 18px;
  line-height: 1.6;
}
.setup-guide code {
  background: var(--gm-surface-sunken);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  user-select: all;
}

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

.empty-state-box {
  text-align: center;
  padding: 36px 16px;
  background: var(--gm-surface);
  border: 1px dashed var(--gm-border);
  border-radius: 12px;
  color: var(--gm-text-secondary);
}
.empty-state-box h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--gm-text);
}
.empty-state-box p {
  font-size: 13px;
  margin: 0 0 16px;
  line-height: 1.5;
}
.empty-state-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.empty-state-actions button {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 19px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.empty-state-actions .btn-empty-reset {
  border: 1px solid var(--gm-border);
  background: var(--gm-surface);
  color: var(--gm-text);
}
.empty-state-actions .btn-empty-add {
  border: none;
  background: var(--gm-blue);
  color: #ffffff;
}

@media (max-width: 420px) {
  .field-row-2,
  .mapping-grid,
  .extra-fields-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 640px) {
  .sheet-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
  }
}

@media (min-width: 768px) {
  .modal-card {
    border-radius: 20px;
    margin-bottom: 30px;
    height: auto;
    max-height: 85dvh;
    box-shadow: 0 4px 24px rgba(60, 64, 67, 0.25);
  }
}

/* ==================== GOOGLE ACCOUNT SIGN-IN GATE ==================== */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background-color: rgba(248, 249, 250, 0.98);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 20px) 20px calc(var(--safe-bottom) + 20px);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--gm-surface);
  border: 1px solid var(--gm-border-subtle);
  border-radius: 16px;
  padding: 32px 28px 24px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(60, 64, 67, 0.15);
}

.ledger-header-line {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ledger-vol {
  font-size: 13px;
  font-weight: 600;
  color: var(--gm-text-secondary);
}

.login-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--gm-text);
  line-height: 1.2;
}

.login-desc {
  margin: 0 0 20px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--gm-text-secondary);
}

.ledger-stamp-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  background: var(--gm-surface-variant);
  border: 1px solid var(--gm-border-subtle);
  border-radius: 10px;
  margin-bottom: 20px;
}

.preview-stamp {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  border-radius: 6px;
  background: var(--gm-surface);
  border: 1px solid var(--gm-border-subtle);
}
.preview-stamp .hanja {
  font-size: 14px;
}
.preview-stamp .kor {
  font-size: 11.5px;
  font-weight: 600;
  margin-top: 2px;
}
.preview-stamp.again { color: var(--gm-green); background: var(--gm-green-light); border-color: var(--gm-green-tint); }
.preview-stamp.unvisited { color: var(--gm-blue); background: var(--gm-blue-light); border-color: var(--gm-blue-tint); }
.preview-stamp.no { color: var(--gm-text-secondary); background: var(--gm-surface-sunken); }

/* Official Google Sign-In Button Style */
.google-login-btn {
  width: 100%;
  min-height: 46px;
  border-radius: 23px;
  border: 1px solid var(--gm-border);
  background: var(--gm-surface);
  color: var(--gm-text);
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.15);
  transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.google-login-btn:hover {
  background: var(--gm-surface-variant);
  border-color: var(--gm-text-muted);
  box-shadow: var(--gm-shadow-sm);
}

.google-login-btn:active {
  transform: scale(0.98);
}

.gate-settings-link {
  width: 100%;
  margin-top: 12px;
  min-height: 38px;
  border: none;
  background: none;
  color: var(--gm-blue);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.gate-settings-link:hover {
  text-decoration: underline;
}

/* Google Material SnackBar Toast */
.snackbar {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 24px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #323232;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 13.5px;
  font-weight: 500;
  z-index: 3000;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.2, 0, 0, 1);
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.snackbar.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* Visible keyboard focus + reduced motion */
:focus-visible {
  outline: 2px solid var(--gm-blue);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
