:root {
  --bg: #FAF8F5;
  --surface: #FFFFFF;
  --surface-2: #F5F3F0;
  --surface-3: #EDEBE8;
  --border: #E5E2DD;
  --border-light: #D5D2CD;
  --text: #1a1a1a;
  --text-muted: #888580;
  --accent: #B8860B;
  --accent-dim: rgba(184, 134, 11, 0.08);
  --accent-hover: #9A7209;
  --green: #3D7A3B;
  --blue: #2E6B8A;
  --purple: #6B4E8A;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  padding: 48px 60px;
  max-width: 1440px;
  margin: 0 auto;
}

/* ---- Header ---- */
header { margin-bottom: 32px; }

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; flex-direction: column; }

h1 {
  font-family: var(--serif);
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--text);
  line-height: 1;
}

.tagline {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 8px;
  font-weight: 500;
}

.header-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.venue-count {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

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

/* ---- Search bar ---- */
.search-wrapper {
  position: relative;
  margin-bottom: 20px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}

.search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 14px 18px 14px 46px;
  border-radius: 4px;
  font-size: 15px;
  font-family: var(--sans);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.search-input::placeholder { color: var(--text-muted); }

.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  max-height: 420px;
  overflow-y: auto;
  z-index: 1100;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  padding: 4px 0;
}

.search-wrapper.open .search-results { display: block; }

.sr-item {
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--surface-2);
}

.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: var(--surface-2); }

.sr-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sr-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.sr-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.sr-quality {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

.sr-quality.a-plus { background: var(--accent); color: #fff; }
.sr-quality.a { background: var(--green); color: #fff; }
.sr-quality.b-plus { background: var(--blue); color: #fff; }
.sr-quality.b { background: var(--surface-3); color: var(--text-muted); }

.sr-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  padding-left: 18px;
}

.sr-empty {
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* ---- Controls row ---- */
.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.filter-group { position: relative; }

select, .toggle-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-family: var(--sans);
  cursor: pointer;
  height: 36px;
  transition: border-color 0.15s;
}

select:hover, .toggle-btn:hover { border-color: var(--border-light); }
select:focus, .toggle-btn:focus { outline: none; border-color: var(--accent); }
.toggle-btn { font-weight: 600; transition: all 0.2s; }
.toggle-btn.active { background: var(--text); border-color: var(--text); color: var(--bg); }

/* ---- Multi-select dropdown ---- */
.multi-select { position: relative; }

.ms-trigger {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 32px 8px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-family: var(--sans);
  cursor: pointer;
  height: 36px;
  white-space: nowrap;
  min-width: 160px;
  text-align: left;
  position: relative;
  transition: border-color 0.15s;
}

.ms-trigger:hover { border-color: var(--border-light); }

.ms-trigger::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-muted);
}

.ms-trigger.has-selection { border-color: var(--accent); color: var(--text); }

.ms-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  min-width: 280px;
  max-height: 380px;
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  overflow: hidden;
  flex-direction: column;
}

.multi-select.open .ms-dropdown { display: flex; }

.ms-search-wrap {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.ms-search {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--sans);
}

.ms-search:focus { outline: none; border-color: var(--accent); }

.ms-actions {
  display: flex;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.ms-action-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  font-family: var(--sans);
}

.ms-action-btn:hover { text-decoration: underline; }

.ms-options {
  overflow-y: auto;
  max-height: 280px;
  padding: 4px 0;
}

.ms-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  transition: background 0.1s;
}

.ms-option:hover { background: var(--surface-2); }
.ms-option.hidden { display: none; }

.ms-option input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.ms-option .ms-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.ms-option .ms-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ms-option .ms-count {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ---- Active pills ---- */
.active-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  min-height: 0;
}

.active-pills:empty { margin-top: 0; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  cursor: default;
  line-height: 1.3;
}

.pill .pill-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.pill .pill-remove {
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  opacity: 0.5;
  margin-left: 2px;
  font-weight: 700;
  transition: opacity 0.1s;
}

.pill .pill-remove:hover { opacity: 1; }
.pill.pill-neighborhood { background: var(--surface-3); }
.pill.pill-restaurant { background: var(--accent-dim); border: 1px solid rgba(184,134,11,0.2); }

/* ---- Weekly grid layout ---- */
.grid-wrapper {
  background: var(--surface);
  border-radius: 2px;
  padding: 24px;
  border: 1px solid var(--border);
  overflow-x: auto;
}

.day-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.day-header {
  text-align: center;
  padding: 12px 4px 10px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s;
}

.day-header .dh-name {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
}

.day-header .dh-count {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  opacity: 0.6;
}

.day-header.today { border-bottom-color: var(--text); }
.day-header.today .dh-name { color: var(--text); }

.time-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  align-items: start;
}

.day-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.day-column.today {
  background: var(--accent-dim);
  border-radius: 4px;
  padding: 6px;
}

.empty-day {
  text-align: center;
  padding: 28px 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
  opacity: 0.5;
}

/* ---- Time blocks ---- */
.time-block {
  background: var(--surface);
  border-radius: 2px;
  border: 1px solid var(--border);
  border-top: 2px solid var(--slot-accent, var(--text));
  overflow: hidden;
  transition: border-color 0.15s;
}

.time-block:hover { border-color: var(--border-light); }

.block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px 8px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

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

.block-slot-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.block-time {
  font-size: 10px;
  color: var(--text-muted);
}

.block-count {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--surface-3);
  padding: 2px 8px;
  border-radius: 2px;
  min-width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.block-list { padding: 4px 0; }

.block-list::-webkit-scrollbar { width: 4px; }
.block-list::-webkit-scrollbar-track { background: transparent; }
.block-list::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 2px;
}

.block-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  transition: background 0.1s;
  min-width: 0;
}

.block-item:hover { background: var(--surface-2); }

.block-item-hidden { display: none; }
.block-list.expanded .block-item-hidden { display: flex; }

.bi-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.bi-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.bi-name {
  font-weight: 500;
  line-height: 1.35;
}

.bi-time {
  font-size: 9px;
  color: var(--text-muted);
  line-height: 1.2;
  margin-top: 1px;
}

.q-badge {
  font-size: 8px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 2px;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
  line-height: 1.2;
  letter-spacing: 0.3px;
}

.block-expand {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  text-align: center;
  transition: background 0.1s;
}

.block-expand:hover { background: var(--surface-2); }

/* ---- Detail panel (slide-in) ---- */
.detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 1999;
  backdrop-filter: blur(2px);
}

.detail-overlay.open { display: block; }

.detail-panel {
  position: fixed;
  right: -420px;
  top: 0;
  bottom: 0;
  width: 400px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0,0,0,0.08);
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.detail-panel.open { right: 0; }

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 28px 24px;
  border-bottom: 1px solid var(--border);
}

.detail-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 24px;
  color: var(--text);
  line-height: 1.15;
}

.detail-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.15s;
}

.detail-close:hover { color: var(--text); }

.detail-body {
  padding: 24px 28px;
  overflow-y: auto;
  flex: 1;
}

.detail-quality {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 2px;
  margin-bottom: 20px;
  letter-spacing: 0.5px;
}

.detail-quality.a-plus { background: var(--accent); color: #fff; }
.detail-quality.a { background: var(--green); color: #fff; }
.detail-quality.b-plus { background: var(--blue); color: #fff; }
.detail-quality.b { background: var(--surface-3); color: var(--text-muted); }

.detail-meta {
  margin-bottom: 24px;
  line-height: 1.7;
}

.detail-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.detail-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
  display: inline-block;
}

.detail-section { margin-bottom: 20px; }

.detail-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text);
  margin-bottom: 8px;
}

.detail-section ul { list-style: none; padding: 0; }

.detail-section li {
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
  padding-left: 16px;
  position: relative;
}

.detail-section li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
}

.detail-value {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  line-height: 1.6;
}

/* ---- Tippy tooltip ---- */
.tippy-box[data-theme~='happy-hour'] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0;
  max-width: 320px;
  font-family: var(--sans);
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.tippy-box[data-theme~='happy-hour'] .tippy-arrow { color: var(--surface); }
.tippy-box[data-theme~='happy-hour'] .tippy-content { padding: 0; }

.tooltip-inner { padding: 14px 16px; }

.tooltip-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.tooltip-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  line-height: 1.2;
}

.tooltip-quality {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 2px;
  flex-shrink: 0;
  margin-left: 8px;
}

.tooltip-quality.a-plus { background: var(--accent); color: #fff; }
.tooltip-quality.a { background: var(--green); color: #fff; }
.tooltip-quality.b-plus { background: var(--blue); color: #fff; }
.tooltip-quality.b { background: var(--surface-3); color: var(--text-muted); }

.tooltip-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

.tooltip-meta span { display: block; }

.tooltip-section { margin-bottom: 8px; }

.tooltip-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text);
  margin-bottom: 4px;
}

.tooltip-section ul { list-style: none; padding: 0; }

.tooltip-section li {
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
  padding-left: 12px;
  position: relative;
}

.tooltip-section li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
}

.tooltip-value {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  line-height: 1.4;
}

/* ---- Footer ---- */
footer {
  margin-top: 36px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 24px 0;
  border-top: 1px solid var(--border);
  letter-spacing: 0.5px;
}

/* ---- Map section ---- */
.map-section {
  margin-top: 24px;
}

.map-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.map-title {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.map-count {
  font-size: 12px;
  color: var(--text-muted);
}

#map {
  width: 100%;
  height: 480px;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.map-tooltip {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.map-popup {
  font-family: var(--sans);
  line-height: 1.5;
}

.map-popup strong {
  font-size: 14px;
  display: block;
  margin-bottom: 2px;
}

.map-popup-meta {
  font-size: 12px;
  color: #666;
}

.map-popup-quality {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 2px;
}

.map-popup-quality.a-plus { background: var(--accent); color: #fff; }
.map-popup-quality.a { background: var(--green); color: #fff; }
.map-popup-quality.b-plus { background: var(--blue); color: #fff; }
.map-popup-quality.b { background: var(--surface-3); color: var(--text-muted); }

.map-popup-addr {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}

.map-popup-deal {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

/* ---- Mobile day navigation ---- */
.mobile-day-nav {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 0;
  margin-bottom: 8px;
}

.mdn-arrow {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-family: var(--sans);
  line-height: 1;
}

.mdn-arrow:hover {
  background: var(--surface-2);
  border-color: var(--border-light);
}

.mdn-arrow:active {
  transform: scale(0.95);
}

.mdn-label {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  min-width: 180px;
  text-align: center;
}

/* ---- Mobile hidden utility ---- */
.day-column.mobile-hidden { /* applied via JS on mobile */ }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .day-headers, .time-grid {
    grid-template-columns: repeat(7, minmax(120px, 1fr));
  }
}

@media (max-width: 768px) {
  body { padding: 16px; }
  h1 { font-size: 36px; }
  .header-top { flex-direction: column; align-items: flex-start; gap: 8px; }
  .header-meta { align-items: flex-start; }
  .controls { gap: 8px; }
  .ms-trigger { min-width: 130px; font-size: 12px; }
  .grid-wrapper { padding: 12px; }

  .mobile-day-nav { display: flex; }
  .day-headers { display: none; }

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

  .day-column.mobile-hidden { display: none; }

  .block-item { font-size: 11px; padding: 5px 10px; }
  .block-slot-name { font-size: 9px; }
  .block-time { font-size: 9px; }

  #map { height: 360px; }

  .map-title { font-size: 20px; }

  .detail-panel { width: calc(100vw - 24px); right: -100vw; }
  .detail-panel.open { right: 0; }
}
