:root{
  --bg:#0b0f19;
  --panel:#111827;
  --panel-2:#0f172a;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --border:#1f2937;
  --accent:#8b5cf6;
  --accent-2:#3b82f6;
  --success:#10b981;
  --danger:#ef4444;
  --radius:16px;
  --shadow:0 6px 20px rgba(0,0,0,.25);
  --topbar-h:56px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font:16px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Inter,Arial,sans-serif;
}

button,input,select,textarea{
  font:inherit;
  color:inherit;
}

a{
  color:inherit;
  text-decoration:none;
}

/* ---------- Top bar ---------- */

.topbar{
  position:sticky;
  top:0;
  z-index:40;
  display:flex;
  align-items:center;
  justify-content:space-between;
  height:var(--topbar-h);
  padding:10px 16px;
  border-bottom:1px solid var(--border);
  background:linear-gradient(180deg,rgba(15,23,42,.95),rgba(15,23,42,.85));
  backdrop-filter:blur(8px);
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:700;
}

.logo-dot{
  color:var(--accent);
  font-size:18px;
}

.logo-text{
  letter-spacing:.02em;
}

.actions{
  display:flex;
  align-items:center;
  gap:8px;
}

/* ---------- Buttons ---------- */

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:36px;
  padding:0 14px;
  border-radius:999px;
  border:1px solid transparent;
  background:transparent;
  color:var(--text);
  font-weight:600;
  cursor:pointer;
  transition:background .12s ease,border-color .12s ease,transform .08s ease;
}

.btn:active{
  transform:translateY(1px) scale(.98);
}

.btn.primary{
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  color:#fff;
  box-shadow:var(--shadow);
}

.btn.primary:disabled{
  opacity:.6;
  cursor:not-allowed;
}

.btn.ghost{
  border-color:var(--border);
}

.btn.ghost:hover{
  border-color:#334155;
  background:#020617;
}

.btn.icon{
  width:32px;
  height:32px;
  padding:0;
  border-radius:999px;
  font-size:14px;
}

.btn.ghost[aria-current="page"],
.btn.ghost.active{
  background:#0b1120;
  border-color:#334155;
}

/* ---------- Layout + sidebar ---------- */

.layout{
  position:relative;
  max-width:1200px;
  margin:0 auto;
  padding:0 8px 16px;
}

.sidebar{
  position:fixed;
  left:0;
  top:var(--topbar-h);
  bottom:0;
  width:280px;
  background:var(--panel-2);
  border-right:1px solid var(--border);
  transform:translateX(-100%);
  transition:transform .18s ease-out;
  z-index:30;
  overflow-y:auto;
}

#sidebar-toggle:checked ~ .layout .sidebar{
  transform:translateX(0);
}

.sidebar-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 12px;
  border-bottom:1px solid var(--border);
}

.sidebar-title{
  margin:0;
  font-size:18px;
}

.sidebar-actions{
  display:flex;
  align-items:center;
  gap:8px;
}

.conv-list{
  list-style:none;
  margin:0;
  padding:6px 0 10px;
}

.conv-item{
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  cursor:pointer;
  transition:background .12s ease;
}

.conv-item:hover{
  background:#020617;
}

.conv-item.active,
.conv-item[aria-selected="true"]{
  background:#0b1120;
}

.conv-title{
  font-weight:600;
  margin:0 0 2px;
  font-size:14px;
}

.conv-preview{
  margin:0;
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.row-actions{
  display:flex;
  gap:6px;
  opacity:0;
  transition:opacity .12s ease;
}

.conv-item:hover .row-actions,
.conv-item:focus-within .row-actions{
  opacity:1;
}

/* ---------- Chat ---------- */

.chat{
  min-height:calc(100vh - var(--topbar-h));
  padding:12px 4px 80px;
  display:flex;
  flex-direction:column;
}

.chat-list{
  list-style:none;
  margin:0;
  padding:10px 8px 64px;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.msg{
  display:flex;
  gap:10px;
}

.avatar{
  width:32px;
  height:32px;
  border-radius:50%;
  background:#1f2937;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:16px;
}

.msg .bubble{
  max-width:min(720px,80vw);
  padding:12px 14px;
  border-radius:18px;
  background:var(--panel);
  color:var(--text);
  box-shadow:var(--shadow);
  word-break:break-word;
}

.msg.user{
  justify-content:flex-end;
}

.msg.user .avatar{
  order:2;
}

.msg.user .bubble{
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  color:#fff;
}

.bubble.error{
  border:1px solid rgba(239,68,68,.5);
}

.sender{
  font-size:12px;
  color:var(--muted);
  margin-bottom:4px;
  letter-spacing:.02em;
}

/* ---------- Inline map card in chat ---------- */

.map-card{
  margin-top:10px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--panel-2);
  overflow:hidden;
}

.map-card-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:8px 10px;
  border-bottom:1px solid var(--border);
  font-size:13px;
  color:var(--muted);
}

.map-card-iframe-wrap{
  width:100%;
  height:260px;
}

.map-card-iframe{
  width:100%;
  height:100%;
  border:0;
}

/* ---------- Composer ---------- */

.composer{
  position:sticky;
  bottom:0;
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 8px;
  margin-top:6px;
  background:linear-gradient(180deg,rgba(11,15,25,0) 0%,rgba(11,15,25,1) 30%);
  backdrop-filter:blur(2px);
  border-top:1px solid var(--border);
}

.composer input[type="text"]{
  flex:1;
  height:44px;
  padding:0 14px;
  border-radius:12px;
  border:1px solid #1f2a44;
  background:#020617;
  color:var(--text);
  outline:none;
}

.composer input::placeholder{
  color:#64748b;
}

/* ---------- Legacy feed-in-chat styles (kept for compatibility) ---------- */

.feed{
  min-height:calc(100vh - var(--topbar-h));
  padding:12px 4px 80px;
  display:flex;
  flex-direction:column;
}

.feed-list{
  list-style:none;
  margin:0;
  padding:10px 8px 64px;
  display:flex;
  flex-direction:column;
  gap:16px;
}

.feed-card{
  background:var(--panel);
  border-radius:var(--radius);
  border:1px solid var(--border);
  box-shadow:var(--shadow);
  padding:12px 12px 14px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.feed-card-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  font-weight:600;
}

.feed-card-meta{
  font-size:12px;
  color:var(--muted);
}

.feed-card-image{
  width:100%;
  border-radius:12px;
  background:#020617;
  aspect-ratio:16/9;
  object-fit:cover;
}

.feed-card-tags{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:2px;
}

.feed-tag{
  font-size:11px;
  padding:3px 8px;
  border-radius:999px;
  background:#020617;
  border:1px solid #1f2937;
  color:var(--muted);
}

.feed-card-actions{
  margin-top:4px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

/* ---------- Map side panel ---------- */

.map-panel[hidden]{display:none!important}

.map-panel{
  position:fixed;
  right:0;
  top:var(--topbar-h);
  bottom:0;
  width:min(480px,100vw);
  background:#020617;
  border-left:1px solid var(--border);
  box-shadow:-10px 0 30px rgba(0,0,0,.35);
  display:flex;
  flex-direction:column;
  z-index:35;
}

.map-panel-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  background:#0b1120;
}

.map-title{
  margin:0;
  font-size:16px;
  color:var(--muted);
}

.map-actions{
  display:flex;
  gap:8px;
  align-items:center;
}

.map-iframe-wrap{
  flex:1;
}

.map-iframe{
  width:100%;
  height:100%;
  border:0;
  background:#000;
}

.map-attrib{
  padding:8px 12px;
  border-top:1px solid var(--border);
  font-size:12px;
  color:var(--muted);
}

.map-attrib a{
  color:var(--muted);
  text-decoration:underline;
}

/* ---------- Settings drawer ---------- */

.drawer[hidden]{display:none}

.drawer{
  position:fixed;
  inset:0;
  z-index:50;
}

.drawer-backdrop{
  position:absolute;
  inset:0;
  background:rgba(2,6,23,.6);
  backdrop-filter:saturate(150%) blur(2px);
}

.drawer-sheet{
  position:absolute;
  top:0;
  right:0;
  height:100%;
  width:min(420px,100%);
  background:#020617;
  border-left:1px solid #1f2937;
  display:flex;
  flex-direction:column;
}

.drawer-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 14px;
  border-bottom:1px solid #1f2937;
}

.drawer-body{
  padding:14px;
  overflow:auto;
}

.drawer-body fieldset{
  border:none;
  margin:0;
  padding:0;
}

.drawer-body legend{
  font-weight:600;
  margin-bottom:10px;
}

.drawer-body .row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 0;
  border-bottom:1px dashed #1f2937;
}

.drawer-body .row:last-child{
  border-bottom:none;
}

/* ---------- Party-up modal ---------- */

.modal-overlay[hidden]{display:none!important}

.modal-overlay{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,.45);
  z-index:45;
}

.modal{
  width:min(560px,calc(100vw - 32px));
  background:var(--panel);
  border-radius:var(--radius);
  border:1px solid var(--border);
  box-shadow:var(--shadow);
}

.modal-header{
  display:flex;
  align-items:center;
  gap:8px;
  padding:12px 14px;
  border-bottom:1px solid var(--border);
}

.modal-header h3{
  margin:0;
}

.modal-body{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  padding:14px;
}

.modal-body label{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-weight:600;
  font-size:14px;
}

.modal-body input,
.modal-body select{
  height:42px;
  border-radius:12px;
  border:1px solid #1f2a44;
  background:#020617;
  color:var(--text);
  padding:0 12px;
  outline:none;
}

.modal-actions{
  grid-column:1 / -1;
  display:flex;
  justify-content:flex-end;
  gap:8px;
  margin-top:8px;
}

/* ---------- Misc ---------- */

.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid #334155;
  background:#020617;
  font-weight:600;
  font-size:12px;
  color:#e5e7eb;
}

.badge::before{
  content:"⏳";
  opacity:.9;
}

.badge.pulse{
  animation:puPulse 1.4s ease-in-out infinite;
}

.sr-only{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  border:0;
}

.conv-item:focus-visible{
  outline:2px solid var(--accent-2);
  outline-offset:-2px;
}

/* ---------- Standalone feed page (/feed) ---------- */

.feed-shell{
  max-width:960px;
  margin:0 auto;
  padding:16px 16px 32px;
}

.feed-topbar-secondary{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}

.feed-topbar-secondary .right{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.feed-header{
  margin:8px 0 16px;
}

.feed-title-main{
  margin:0 0 4px;
  font-size:1.6rem;
  font-weight:700;
}

.feed-subtitle{
  margin:0;
  font-size:.9rem;
  color:var(--muted);
}

.feed-filters{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:8px 0 16px;
}

.chip{
  border-radius:999px;
  border:1px solid var(--border);
  padding:6px 12px;
  background:#020617;
  color:var(--muted);
  font-size:.8rem;
  cursor:pointer;
  transition:background .15s ease,border-color .15s ease,color .15s ease;
}

.chip.is-active{
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  border-color:transparent;
  color:#fff;
}

.feed-list{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:16px;
}

.feed-card{
  border-radius:18px;
  background:var(--panel);
  border:1px solid var(--border);
  box-shadow:var(--shadow);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

/* visual hero at top of a route card */
.feed-cover{
  position:relative;
  width:100%;
  padding-top:58%;
  background-size:cover;
  background-position:center;
  background-repeat:no-repeat;
  background-image:
    radial-gradient(circle at top,rgba(148,163,184,.6),transparent 55%),
    radial-gradient(circle at bottom,rgba(15,23,42,.9),#020617);
}

/* gradient variants while we don’t have photos for every route */
.feed-cover--jazz{
  background-image:linear-gradient(135deg,#0f172a,#1d4ed8);
}

.feed-cover--speakeasy{
  background-image:linear-gradient(135deg,#111827,#4b5563);
}

.feed-cover--rooftop{
  background-image:linear-gradient(135deg,#1e293b,#f97316);
}

.feed-cover--craft{
  background-image:linear-gradient(135deg,#020617,#22c55e);
}

.feed-cover--date{
  background-image:linear-gradient(135deg,#111827,#ec4899);
}

.feed-cover--live{
  background-image:linear-gradient(135deg,#0f172a,#a855f7);
}

.feed-cover--club{
  background-image:linear-gradient(135deg,#020617,#e11d48);
}

.feed-cover--dive{
  background-image:linear-gradient(135deg,#020617,#64748b);
}

.feed-cover--girls{
  background-image:linear-gradient(135deg,#111827,#fb7185);
}

.feed-cover--afterwork{
  background-image:linear-gradient(135deg,#0f172a,#22c55e);
}

.feed-content{
  padding:12px 14px 12px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.feed-card-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}

.feed-card-title{
  margin:0;
  font-size:1rem;
  font-weight:600;
}

.feed-pill{
  font-size:.75rem;
  padding:4px 8px;
  border-radius:999px;
  background:rgba(15,23,42,.9);
  border:1px solid rgba(148,163,184,.4);
  color:var(--muted);
  white-space:nowrap;
}

.feed-card-route{
  margin:0;
  font-size:.9rem;
}

.feed-card-meta{
  margin:0;
  font-size:.8rem;
  color:var(--muted);
}

.feed-card-footer{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:4px;
}

.feed-card-footer .btn{
  height:32px;
  padding:0 12px;
  font-size:.85rem;
}

/* ---------- Responsive tweaks ---------- */

@media (min-width:768px){
  .feed-shell{
    padding:20px 20px 40px;
  }

  .feed-title-main{
    font-size:1.9rem;
  }
}

@media (min-width:1024px){
  #toggle-sidebar{display:none}

  .layout{
    display:grid;
    grid-template-columns:300px minmax(0,1fr);
    gap:0;
  }

  .sidebar{
    position:static;
    transform:none;
    height:calc(100vh - var(--topbar-h));
  }

  .chat,
  .feed{
    padding:16px 16px 80px;
  }
}

/* ---------- Animations ---------- */

@keyframes puPulse{
  0%,100%{opacity:1}
  50%{opacity:.78}
}
