/* Colors and shapes follow the Enqlare Lunch design canvas. */
:root {
  --navy: #022231;
  --ink: #1B1E3E;
  --slate: #303B41;
  --muted: #5A6871;
  --blue: #1473E6;
  --blue-dark: #0C447C;
  --border: #B4C9D8;
  --line: #EBEBF0;
  --tint: #E7ECF0;
  --bg: #F7F9FA;
  --white: #FFFFFF;
  --error: #B42318;
  --shadow: 0 2px 12px rgba(27, 30, 62, .08);
  --pill: 80px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }
body {
  font-family: Inter, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--bg);
}
h1, h2, p { margin: 0; }
h2 { font-size: 26px; line-height: 1.3; font-weight: 700; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue-dark); }
a:hover { color: var(--ink); }
button:focus-visible, input:focus-visible, textarea:focus-visible, .leaflet-marker-icon:focus-visible {
  outline: 2px solid var(--blue-dark);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.stack-4, .stack-6, .stack-8, .stack-10, .stack-18, .stack-20, .stack-24 { display: flex; flex-direction: column; }
.stack-4 { gap: 4px; } .stack-6 { gap: 6px; } .stack-8 { gap: 8px; } .stack-10 { gap: 10px; }
.stack-18 { gap: 18px; } .stack-20 { gap: 20px; } .stack-24 { gap: 24px; }

.lead { font-size: 15px; line-height: 24px; font-weight: 500; color: var(--slate); }
.muted-13 { font-size: 13px; font-weight: 500; color: var(--muted); }
.muted-14 { font-size: 14px; font-weight: 500; color: var(--muted); }
.field-label { font-size: 14px; font-weight: 700; }
.field-hint { font-weight: 500; color: var(--muted); }
.error { font-size: 14px; font-weight: 500; color: var(--error); }

.card { background: var(--white); border-radius: 20px; box-shadow: var(--shadow); }

.eyebrow {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; letter-spacing: .78px; text-transform: uppercase; color: var(--blue-dark);
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--blue); flex-shrink: 0; }

/* Form controls */
.input {
  width: 100%; height: 44px; padding: 0 18px;
  border: 1px solid var(--border); border-radius: var(--pill);
  font-size: 15px; font-weight: 500; background: var(--white);
}
.textarea {
  width: 100%; padding: 12px 16px; resize: none;
  border: 1px solid var(--border); border-radius: 14px;
  font-size: 15px; font-weight: 500; line-height: 22px;
}
.search { position: relative; }
.search svg { position: absolute; left: 16px; top: 13px; pointer-events: none; }
.search .input { padding-left: 44px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 22px; border-radius: var(--pill);
  font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap;
}
.btn-primary { border: none; background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-outline { border: 1px solid var(--ink); background: var(--white); color: var(--ink); font-weight: 500; }
.btn-outline:hover { background: var(--bg); }
.btn-danger { border: none; background: var(--error); color: var(--white); }
.btn-danger:hover { background: #8F1C13; }
.btn-danger-outline { border: 1px solid var(--error); background: var(--white); color: var(--error); font-weight: 500; }
.btn-danger-outline:hover { background: #FEF3F2; }
.btn-link {
  align-self: center; min-height: 36px; border: none; background: transparent;
  color: var(--blue-dark); font-size: 14px; font-weight: 500;
}
.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0; border: none; border-radius: 50%;
  background: var(--bg); color: var(--ink); display: flex; align-items: center; justify-content: center;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 36px; padding: 0 14px; border-radius: var(--pill);
  border: 1px solid var(--border); background: var(--white); color: var(--ink);
  font-size: 14px; font-weight: 500;
}
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--white); }
.chip-new { border-style: dashed; border-color: var(--blue-dark); color: var(--blue-dark); }

.avatar {
  border-radius: 50%; color: var(--white); font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ---------- Sign in ---------- */
.signin { min-height: 100%; display: flex; }
.signin-brand {
  width: 460px; flex-shrink: 0; position: relative; overflow: hidden;
  padding: 56px 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: var(--navy);
}
/* Shifted up so the rating pills sit above the heading, not behind it. */
.signin-decor { position: absolute; left: 0; top: -160px; }
.signin-wordmark { position: relative; font-size: 18px; font-weight: 700; color: var(--white); }
.signin-wordmark span { color: var(--border); }
.signin-pitch { position: relative; display: flex; flex-direction: column; gap: 14px; }
.signin-pitch h1 { font-size: 40px; line-height: 1.2; font-weight: 700; color: var(--white); }
.signin-pitch p { font-size: 16px; line-height: 28px; font-weight: 500; color: var(--border); }
.signin-main { flex-grow: 1; display: flex; align-items: center; justify-content: center; padding: 48px; }
.signin-card { width: 420px; max-width: 100%; display: flex; flex-direction: column; gap: 24px; padding: 32px; }
.signin-card .input { height: 48px; font-size: 16px; }
.signin-card .btn { min-height: 48px; }

.people { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.person {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 6px; border-radius: 14px; border: 2px solid var(--line); background: var(--white);
  font-size: 14px; font-weight: 700; overflow-wrap: anywhere;
}
.person .avatar { width: 40px; height: 40px; font-size: 15px; }
.person[aria-pressed="true"] { border-color: var(--blue); background: var(--tint); }
.person-new { border-style: dashed; border-color: var(--border); color: var(--blue-dark); }
.person-new .avatar { background: var(--tint); }

@media (max-width: 820px) {
  .signin { flex-direction: column; }
  .signin-brand { width: auto; padding: 32px 24px; gap: 24px; }
  .signin-decor { display: none; }
  .signin-pitch h1 { font-size: 30px; }
  .signin-main { padding: 24px 16px; }
}

/* ---------- App shell ---------- */
.app { height: 100%; display: flex; flex-direction: column; }
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  padding: 14px 24px; background: var(--white); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; flex-grow: 1; min-width: 0; }
.logo {
  width: 40px; height: 40px; border-radius: 10px; background: var(--navy); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.wordmark { font-size: 18px; font-weight: 700; line-height: 22px; }
.wordmark span { color: var(--blue-dark); }
.me-chip {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px 0 6px;
  border: none; border-radius: var(--pill); background: var(--tint); font-size: 14px; font-weight: 700;
}
.me-chip .avatar { width: 32px; height: 32px; font-size: 13px; }

.layout { flex: 1; min-height: 0; display: flex; }

.sidebar {
  flex: 0 1 400px; min-width: 320px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 20px; padding: 24px;
  background: var(--white); border-right: 1px solid var(--line);
}
.list-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 12px; border-top: 1px solid var(--line);
}
.sorts { display: flex; gap: 4px; }
.sort {
  min-height: 32px; padding: 0 12px; border: none; border-radius: var(--pill);
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 700;
}
.sort[aria-pressed="true"] { background: var(--tint); color: var(--ink); }

.place-list { display: flex; flex-direction: column; gap: 10px; }
.place-card {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; text-align: left;
  border-radius: 14px; border: 1px solid var(--line); background: var(--white);
}
.place-card:hover { border-color: var(--border); }
.place-card[aria-pressed="true"] { border-color: var(--blue); background: var(--tint); }
.place-text { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; min-width: 0; }
.place-name { font-size: 16px; font-weight: 700; line-height: 22px; }
.empty {
  padding: 24px; border-radius: 14px; background: var(--bg);
  font-size: 14px; font-weight: 500; color: var(--slate); line-height: 22px;
}

/* Rating pill, used in the list and as map pins. */
.pill {
  flex-shrink: 0; min-width: 48px; height: 32px; padding: 0 8px; border-radius: var(--pill);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; border: 2px solid;
}
.tier-top { background: var(--blue); color: var(--white); border-color: var(--blue); }
.tier-good { background: var(--white); color: var(--blue-dark); border-color: var(--blue); }
.tier-ok { background: var(--white); color: var(--slate); border-color: var(--border); }
.tier-new { background: var(--white); color: var(--blue-dark); border-color: var(--blue-dark); border-style: dashed; }
.tier-selected { background: var(--navy); color: var(--white); border-color: var(--white); }

/* ---------- Map ---------- */
.map-area { flex: 1; min-width: 0; position: relative; background: var(--bg); }
.map-canvas, #map { position: absolute; inset: 0; }
.leaflet-container { font-family: inherit; background: var(--bg); }
/* Muted tiles so the rating pins stand out, closer to the pale map in the design. */
.leaflet-tile-pane { filter: saturate(.35) brightness(1.04); }

/* Overlays sit above Leaflet's panes and controls (z-index up to 1000). */
.toast, .legend, .detail { position: absolute; z-index: 1001; }

#map .leaflet-top .leaflet-control { margin-top: 20px; }
#map .leaflet-right .leaflet-control { margin-right: 20px; }
.leaflet-touch .leaflet-bar, .leaflet-bar {
  border: none; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow);
}
.leaflet-touch .leaflet-bar a, .leaflet-bar a {
  width: 44px; height: 44px; line-height: 44px; color: var(--ink); font-size: 20px;
}

/* Markers use a 0x0 Leaflet icon at the coordinate; the visible pin is centered on it. */
.pin-anchor { overflow: visible; }
.pin {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  min-width: 48px; height: 32px; padding: 0 10px;
  box-shadow: 0 2px 12px rgba(27, 30, 62, .16);
}
.pin.tier-selected { min-width: 60px; height: 40px; font-size: 16px; }
.pin-name {
  position: absolute; left: 0; top: 26px; transform: translateX(-50%);
  padding: 4px 10px; border-radius: 8px; background: var(--white);
  font-size: 13px; font-weight: 700; white-space: nowrap; box-shadow: 0 2px 12px rgba(27, 30, 62, .12);
}
.office {
  position: absolute; left: 0; top: 0; transform: translate(-50%, calc(-100% + 11px));
  display: flex; flex-direction: column; align-items: center;
}
.office-label {
  padding: 6px 10px; margin-bottom: 6px; border-radius: 8px;
  background: var(--navy); color: var(--white); font-size: 12px; font-weight: 700; white-space: nowrap;
}
.office-square {
  width: 22px; height: 22px; border-radius: 6px; background: var(--navy);
  border: 3px solid var(--white); box-shadow: 0 2px 12px rgba(27, 30, 62, .25);
}
.ring-label {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); white-space: nowrap;
  font-size: 12px; font-weight: 700; color: var(--blue-dark);
  text-shadow: 0 0 3px var(--white), 0 0 3px var(--white), 0 0 3px var(--white);
}

.toast {
  left: 50%; top: 20px; transform: translateX(-50%); max-width: calc(100% - 40px);
  display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 20px;
  border-radius: var(--pill); background: var(--navy); color: var(--white);
  box-shadow: 0 2px 12px rgba(27, 30, 62, .2); font-size: 15px; font-weight: 500;
}
.toast-roll {
  min-height: 36px; padding: 0 14px; border: none; border-radius: var(--pill);
  background: var(--white); color: var(--navy); font-size: 13px; font-weight: 700; white-space: nowrap;
}
.toast-close {
  width: 36px; height: 36px; border: none; border-radius: 50%; background: transparent; color: var(--border);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.legend {
  right: 20px; bottom: 30px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding: 10px 16px; border-radius: 14px; background: var(--white); box-shadow: var(--shadow);
  font-size: 12px; font-weight: 500; color: var(--slate);
}
.legend > span { display: flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 14px; border-radius: 50%; border: 2px solid; }
.swatch-top { background: var(--blue); border-color: var(--blue); }
.swatch-good { border-color: var(--blue); }
.swatch-ok { border-color: var(--border); }
.swatch-new { border-color: var(--blue-dark); border-style: dashed; }

.detail {
  left: 20px; top: 20px; width: 340px; max-width: calc(100% - 40px); max-height: calc(100% - 40px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px; padding: 26px;
}
.detail-head { display: flex; align-items: flex-start; gap: 12px; }
.detail-head h2 { font-size: 24px; }
.detail-score {
  display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-radius: 14px; background: var(--tint);
}
.detail-score strong { font-size: 34px; line-height: 1; }
.detail-score span { display: flex; flex-direction: column; gap: 2px; font-size: 13px; font-weight: 500; color: var(--slate); }
.detail-score b { font-size: 14px; color: var(--ink); }
.detail-note { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--slate); }
.detail-members { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.member { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; }
.member .avatar { width: 28px; height: 28px; font-size: 12px; }
.member-name { flex-grow: 1; }

.stars { display: flex; gap: 2px; }
.star-btn {
  width: 44px; height: 44px; border: none; background: transparent; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.star-btn polygon { fill: var(--white); stroke: var(--border); }
.star-btn.on polygon { fill: var(--blue); stroke: var(--blue); }
.mini-stars { display: flex; gap: 1px; }
.mini-stars polygon { fill: var(--tint); }
.mini-stars .on polygon { fill: var(--blue); }

/* ---------- Add / edit place dialog ---------- */
.place-dialog { padding: 0; border: none; background: transparent; width: 760px; max-width: calc(100% - 32px); }
.place-dialog::backdrop { background: rgba(2, 34, 49, .55); }
.place-form-card { display: flex; flex-direction: column; gap: 22px; padding: 32px; }
.place-head { display: flex; align-items: flex-start; gap: 12px; }
.place-head > div { flex-grow: 1; }
.place-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.place-map-wrap { position: relative; height: 300px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
#place-map { position: absolute; inset: 0; }
.map-hint {
  position: absolute; left: 12px; bottom: 12px; z-index: 1001; pointer-events: none;
  padding: 6px 10px; border-radius: 8px; background: var(--white); box-shadow: var(--shadow);
  font-size: 12px; font-weight: 500; color: var(--slate);
}
.drop-pin {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -100%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.drop-pin-label {
  padding: 4px 10px; border-radius: 8px; background: var(--navy); color: var(--white);
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.place-actions {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px;
  padding-top: 20px; border-top: 1px solid var(--line);
}
/* Delete sits on the left, away from the save button. */
#place-delete { margin-right: auto; }
.delete-question { margin-right: auto; font-size: 15px; font-weight: 700; color: var(--error); }

/* ---------- Narrow screens: map, then the selected place, then the list; page scrolls ---------- */
@media (max-width: 820px) {
  .app { height: auto; min-height: 100%; }
  .topbar { padding: 12px 16px; gap: 10px; }
  .brand { flex-basis: 100%; }
  .layout { flex-direction: column; }
  .map-area { order: -1; flex: none; }
  .map-canvas { position: relative; height: 60vh; }
  .sidebar { flex: none; min-width: 0; overflow: visible; padding: 20px 16px; border-right: none; }
  .legend { left: 16px; right: auto; bottom: 26px; gap: 10px; }
  .detail { position: static; width: auto; max-width: none; max-height: none; margin: 16px 16px 0; padding: 20px; }
  .toast { top: 16px; left: 16px; right: 16px; transform: none; max-width: none; border-radius: 20px; }
  .place-form-card { padding: 20px; }
  .place-grid { grid-template-columns: minmax(0, 1fr); }
}
