:root{
  --bg:#f7f1ea;
  --surface:#fffdfb;
  --surface-2:#f3eadf;
  --espresso:#3b2316;
  --coffee:#6f4e37;
  --coffee-soft:#8a6a52;
  --crema:#c9a27e;
  --crema-light:#e7d2bb;
  --accent:#b9743f;
  --accent-dark:#9c5e30;
  --text:#33271f;
  --text-soft:#7a6557;
  --line:#e8dccd;
  --green:#5f7d52;
  --danger:#b5523f;
  --gold:#c89b3c;
  --radius:16px;
  --radius-sm:11px;
  --shadow:0 1px 0 rgba(59,35,22,.04);
}
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent;}
html,body{height:100%;}
body{
  font-family:'Inter',system-ui,sans-serif;
  background:var(--bg);
  color:var(--text);
  font-size:15px;
  line-height:1.45;
  overscroll-behavior:none;
}
#app{height:100vh;height:100dvh;display:flex;flex-direction:column;}
/* shell wrapper lets nav move to a side rail on desktop */
.shell{flex:1;display:flex;flex-direction:column;min-height:0;min-width:0;}
h1,h2,h3,h4,.serif{font-family:'Fraunces',serif;}
button{font-family:inherit;cursor:pointer;border:none;background:none;color:inherit;font-size:inherit;}
input,textarea,select{font-family:inherit;font-size:15px;color:var(--text);}
img{display:block;max-width:100%;}
a{color:var(--accent-dark);}

.hidden{display:none !important;}

/* ---------- Auth / Landing ---------- */
.auth-wrap{
  flex:1;display:flex;align-items:center;justify-content:center;padding:24px;
  background:
    radial-gradient(circle at 20% 10%, #efe2d2 0, transparent 45%),
    radial-gradient(circle at 85% 90%, #ead9c4 0, transparent 50%),
    var(--bg);
}
.auth-card{
  width:100%;max-width:380px;background:var(--surface);
  border:1px solid var(--line);border-radius:22px;padding:36px 28px;text-align:center;
}
.brand-mark{
  width:62px;height:62px;border-radius:18px;margin:0 auto 18px;
  background:var(--espresso);display:flex;align-items:center;justify-content:center;color:var(--crema-light);
}
.brand-mark svg{width:32px;height:32px;}
.auth-card h1{font-size:30px;letter-spacing:-.5px;color:var(--espresso);font-weight:600;}
.auth-card .tag{color:var(--text-soft);margin:8px 0 26px;font-size:14.5px;}
.auth-card .field{text-align:left;margin-bottom:14px;}
.auth-card label{font-size:12.5px;font-weight:600;color:var(--text-soft);display:block;margin-bottom:6px;text-transform:uppercase;letter-spacing:.4px;}
.input{
  width:100%;padding:12px 14px;border:1px solid var(--line);border-radius:12px;
  background:var(--surface-2);outline:none;transition:border-color .15s,background .15s;
}
.input:focus{border-color:var(--crema);background:#fff;}
textarea.input{resize:vertical;min-height:64px;}

.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:12px 18px;border-radius:12px;font-weight:600;transition:transform .08s,background .15s,opacity .15s;
}
.btn:active{transform:scale(.97);}
.btn-primary{background:var(--espresso);color:#fdf6ee;width:100%;}
.btn-primary:hover{background:#2c1a10;}
.btn-block{width:100%;}
.btn-soft{background:var(--surface-2);color:var(--coffee);border:1px solid var(--line);}
.btn-soft:hover{background:var(--crema-light);}
.btn-ghost{color:var(--text-soft);padding:10px;}
.btn-danger{background:#f7e4df;color:var(--danger);}
.btn-sm{padding:8px 13px;font-size:13.5px;border-radius:10px;}
.btn svg{width:17px;height:17px;}

.muted{color:var(--text-soft);}
.center{text-align:center;}
.err-msg{color:var(--danger);font-size:13px;margin-top:10px;min-height:16px;}

/* ---------- App shell ---------- */
.topbar{
  display:flex;align-items:center;justify-content:space-between;
  padding:14px 18px;background:var(--surface);border-bottom:1px solid var(--line);
  position:sticky;top:0;z-index:20;
}
.topbar .title{font-family:'Fraunces',serif;font-size:21px;font-weight:600;color:var(--espresso);display:flex;align-items:center;gap:9px;letter-spacing:-.3px;}
.topbar .title svg{width:22px;height:22px;color:var(--coffee);}
.topbar-actions{display:flex;gap:6px;align-items:center;}
.icon-btn{
  width:40px;height:40px;border-radius:12px;display:flex;align-items:center;justify-content:center;
  color:var(--coffee);background:transparent;position:relative;transition:background .15s;
}
.icon-btn:hover{background:var(--surface-2);}
.icon-btn svg{width:21px;height:21px;}
.badge-dot{position:absolute;top:8px;right:9px;min-width:16px;height:16px;padding:0 4px;border-radius:9px;background:var(--accent);color:#fff;font-size:10px;font-weight:700;display:flex;align-items:center;justify-content:center;border:2px solid var(--surface);}

.view{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;position:relative;min-height:0;}

/* guest sign-in banner */
.guest-banner{
  display:flex;align-items:center;gap:9px;width:100%;text-align:left;
  padding:11px 16px;background:var(--crema-light);border-bottom:1px solid var(--line);
  color:var(--espresso);font-size:13px;font-weight:500;
}
.guest-banner svg{width:17px;height:17px;flex-shrink:0;color:var(--accent-dark);}
.guest-banner strong{color:var(--accent-dark);text-decoration:underline;}
.view-pad{padding:18px 16px 90px;max-width:680px;margin:0 auto;}

/* ---------- Bottom nav (mobile) / Side rail (desktop) ---------- */
.bottom-nav{
  display:flex;background:var(--surface);border-top:1px solid var(--line);
  padding:7px 6px calc(7px + env(safe-area-inset-bottom));z-index:30;
}
.nav-brand,.nav-messages,.nav-spacer,.nav-profile{display:none;}
.nav-item{
  flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;
  padding:6px 0;color:var(--text-soft);font-size:10.5px;font-weight:600;border-radius:10px;position:relative;
}
.nav-item svg{width:22px;height:22px;transition:transform .12s;}
.nav-item.active{color:var(--espresso);}
.nav-item.active svg{transform:translateY(-1px);}
.nav-item .nav-badge{position:absolute;top:1px;right:50%;margin-right:-20px;min-width:15px;height:15px;padding:0 3px;border-radius:8px;background:var(--accent);color:#fff;font-size:9px;font-weight:700;display:flex;align-items:center;justify-content:center;}

/* ---------- Cards ---------- */
.section-head{display:flex;align-items:center;justify-content:space-between;margin:4px 2px 14px;}
.section-head h2{font-size:23px;color:var(--espresso);font-weight:600;letter-spacing:-.4px;}
.section-sub{color:var(--text-soft);font-size:13px;margin-top:2px;}

.cafe-card{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  overflow:hidden;margin-bottom:13px;transition:border-color .15s;cursor:pointer;
}
.cafe-card:hover{border-color:var(--crema);}
.cafe-card .cc-photo{width:100%;height:148px;object-fit:cover;background:var(--surface-2);}
.cafe-card .cc-body{padding:13px 15px;}
.cafe-card .cc-top{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;}
.cafe-card h3{font-size:17.5px;font-weight:600;color:var(--espresso);line-height:1.25;}
.cafe-card .cc-addr{color:var(--text-soft);font-size:12.5px;margin-top:3px;display:flex;align-items:center;gap:4px;}
.cafe-card .cc-addr svg{width:13px;height:13px;flex-shrink:0;}
.cc-meta{display:flex;flex-wrap:wrap;gap:6px;margin-top:11px;}
.chip{
  display:inline-flex;align-items:center;gap:5px;padding:4px 10px;border-radius:20px;
  background:var(--surface-2);color:var(--coffee);font-size:11.5px;font-weight:600;border:1px solid var(--line);
}
.chip svg{width:12px;height:12px;}
.chip.price{color:var(--green);}

.score{
  flex-shrink:0;min-width:46px;height:46px;border-radius:13px;background:var(--espresso);
  color:#fdf3e9;display:flex;flex-direction:column;align-items:center;justify-content:center;font-family:'Fraunces',serif;
}
.score .num{font-size:19px;font-weight:600;line-height:1;}
.score .lbl{font-size:8px;letter-spacing:.5px;opacity:.7;text-transform:uppercase;margin-top:1px;}
.score.want{background:var(--surface-2);color:var(--coffee-soft);border:1px dashed var(--crema);}
.score.want svg{width:20px;height:20px;}
.cc-del{flex-shrink:0;width:34px;height:34px;border-radius:10px;display:flex;align-items:center;justify-content:center;background:var(--surface-2);color:var(--coffee-soft);transition:background .15s,color .15s;align-self:flex-start;}
.cc-del:hover{background:#f7e4df;color:var(--danger);}
.cc-del svg{width:17px;height:17px;}

.empty{
  text-align:center;padding:50px 24px;color:var(--text-soft);
}
.empty .ic{width:58px;height:58px;border-radius:18px;background:var(--surface-2);display:flex;align-items:center;justify-content:center;margin:0 auto 14px;color:var(--coffee-soft);}
.empty .ic svg{width:28px;height:28px;}
.empty h3{color:var(--espresso);font-size:18px;margin-bottom:6px;font-weight:600;}
.empty p{font-size:13.5px;max-width:260px;margin:0 auto 16px;}

/* segmented */
.segmented{display:flex;background:var(--surface-2);border-radius:12px;padding:4px;gap:4px;margin-bottom:16px;}
.segmented button{flex:1;padding:9px;border-radius:9px;font-weight:600;font-size:13.5px;color:var(--text-soft);transition:.15s;}
.segmented button.active{background:var(--surface);color:var(--espresso);box-shadow:var(--shadow);}

/* ---------- FAB ---------- */
.fab{
  position:absolute;right:18px;bottom:84px;width:56px;height:56px;border-radius:18px;
  background:var(--accent);color:#fff;display:flex;align-items:center;justify-content:center;
  z-index:25;transition:transform .1s,background .15s;
}
.fab:hover{background:var(--accent-dark);}
.fab:active{transform:scale(.93);}
.fab svg{width:26px;height:26px;}

/* ---------- Map ---------- */
.view.map-mode{overflow:hidden;}
#map{position:absolute;inset:0;height:100%;width:100%;z-index:0;}
.map-view{position:absolute;inset:0;}
.leaflet-pane,.leaflet-top,.leaflet-bottom{z-index:1 !important;}
.leaflet-popup{z-index:2 !important;}
.leaflet-container{font-family:inherit;background:var(--surface-2);}
.pin{
  background:var(--espresso);color:#fdf3e9;border-radius:50% 50% 50% 0;width:34px;height:34px;
  transform:rotate(-45deg);display:flex;align-items:center;justify-content:center;
  border:2px solid #fff;font-family:'Fraunces',serif;font-weight:600;
}
.pin span{transform:rotate(45deg);font-size:12px;}
.pin.want{background:var(--crema);color:var(--espresso);}
.pin.friend{background:var(--accent);color:#fff;}
.pop-owner{display:flex;align-items:center;gap:5px;font-size:11.5px;color:var(--accent-dark);font-weight:600;margin-bottom:7px;}
.pop-owner svg{width:13px;height:13px;}
.map-locate{position:absolute;right:14px;bottom:150px;z-index:500;width:44px;height:44px;border-radius:12px;background:var(--surface);border:1px solid var(--line);display:flex;align-items:center;justify-content:center;color:var(--coffee);box-shadow:0 1px 4px rgba(0,0,0,.08);transition:background .15s;}
.map-locate:hover{background:var(--surface-2);}
.map-locate svg{width:21px;height:21px;}
.map-locate.loading{opacity:.6;pointer-events:none;}
.map-locate.loading svg{animation:spin 1s linear infinite;}
.you-dot{width:18px;height:18px;border-radius:50%;background:var(--accent);border:3px solid #fff;box-shadow:0 0 0 4px rgba(185,116,63,.3);}
@media(min-width:900px){ .map-locate{bottom:90px;} }
.map-legend{position:absolute;top:14px;right:14px;z-index:500;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:9px 12px;display:flex;flex-direction:column;gap:6px;font-size:12px;font-weight:600;color:var(--text-soft);}
.map-legend span{display:flex;align-items:center;gap:7px;}
.lg-dot{width:12px;height:12px;border-radius:50%;display:inline-block;}
.lg-dot.mine{background:var(--espresso);}
.lg-dot.friend{background:var(--accent);}
.lg-dot.want{background:var(--crema);}
.leaflet-popup-content-wrapper{border-radius:13px;}
.leaflet-popup-content{margin:12px 14px;}
.map-pop h4{font-family:'Fraunces',serif;font-size:15px;color:var(--espresso);margin-bottom:3px;}
.map-pop .pop-addr{font-size:11.5px;color:var(--text-soft);margin-bottom:8px;}
.map-pop .pop-view{font-size:12.5px;font-weight:700;color:var(--accent-dark);margin-top:9px;}
.pop-friends{margin:8px 0 2px;}
.pop-friends-loading,.pop-friends-empty{font-size:11.5px;color:var(--text-soft);font-style:italic;}
.pop-friends-title{font-size:10.5px;text-transform:uppercase;letter-spacing:.4px;color:var(--coffee);font-weight:700;margin-bottom:6px;}
.pop-friend{display:flex;align-items:center;gap:8px;padding:5px 0;border-top:1px solid var(--line);}
.pop-friend:first-of-type{border-top:none;}
.pf-av{width:28px;height:28px;border-radius:50%;background:var(--crema);color:var(--espresso);display:flex;align-items:center;justify-content:center;font-family:'Fraunces',serif;font-weight:600;font-size:11px;flex-shrink:0;overflow:hidden;}
.pf-av img{width:100%;height:100%;object-fit:cover;}
.pf-info{flex:1;min-width:0;}
.pf-name{font-size:12.5px;font-weight:600;color:var(--espresso);line-height:1.2;}
.pf-meta{font-size:10.5px;color:var(--text-soft);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.pf-msg{width:30px;height:30px;border-radius:9px;background:var(--accent);color:#fff;display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.pf-msg svg{width:15px;height:15px;}

.visitor-row{display:flex;align-items:center;gap:11px;padding:11px;background:var(--surface);border:1px solid var(--line);border-radius:13px;margin-bottom:8px;}
.visitor-row .vr-info{flex:1;min-width:0;}
.visitor-row .vr-name{font-weight:600;color:var(--espresso);font-size:14px;}
.visitor-row .vr-meta{font-size:12px;color:var(--text-soft);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.visitor-row .vr-msg{flex-shrink:0;}

/* ---------- Modal / Sheet ---------- */
.overlay{
  position:fixed;inset:0;background:rgba(40,24,14,.42);z-index:5000;
  display:flex;align-items:flex-end;justify-content:center;
  opacity:0;pointer-events:none;transition:opacity .2s;
}
.overlay.show{opacity:1;pointer-events:auto;}
.sheet{
  width:100%;max-width:560px;max-height:94vh;background:var(--bg);
  border-radius:22px 22px 0 0;overflow-y:auto;transform:translateY(100%);transition:transform .26s cubic-bezier(.3,.9,.3,1);
}
.overlay.show .sheet{transform:translateY(0);}
.sheet-head{
  position:sticky;top:0;background:var(--bg);padding:16px 18px 12px;display:flex;align-items:center;justify-content:space-between;
  border-bottom:1px solid var(--line);z-index:2;
}
.sheet-head h2{font-size:20px;color:var(--espresso);font-weight:600;}
.sheet-body{padding:18px;}
.sheet-grab{width:38px;height:4px;border-radius:3px;background:var(--crema);margin:8px auto 0;}

/* dialog (centered) */
.dialog{
  width:100%;max-width:420px;background:var(--surface);border-radius:20px;margin:auto;
  transform:translateY(20px) scale(.97);transition:transform .2s;align-self:center;
}
.overlay.center{align-items:center;}
.overlay.center .sheet.dialog{transform:translateY(0) scale(1);}
.dialog .sheet-body{padding:22px;}

/* ---------- Forms ---------- */
.form-group{margin-bottom:16px;}
.form-group label{font-size:12.5px;font-weight:600;color:var(--text-soft);display:block;margin-bottom:7px;text-transform:uppercase;letter-spacing:.4px;}
.row{display:flex;gap:10px;}
.row > *{flex:1;}

.search-results{margin-top:8px;border:1px solid var(--line);border-radius:12px;overflow:hidden;background:var(--surface);}
.search-results .sr{padding:11px 13px;border-bottom:1px solid var(--line);cursor:pointer;transition:background .12s;}
.search-results .sr:last-child{border-bottom:none;}
.search-results .sr:hover{background:var(--surface-2);}
.search-results .sr strong{font-weight:600;color:var(--espresso);font-size:14px;}
.search-results .sr div{font-size:12px;color:var(--text-soft);margin-top:2px;}

.tag-grid{display:flex;flex-wrap:wrap;gap:7px;}
.tag-toggle{
  padding:7px 13px;border-radius:20px;border:1px solid var(--line);background:var(--surface);
  font-size:13px;font-weight:600;color:var(--text-soft);transition:.12s;
}
.tag-toggle.on{background:var(--espresso);color:#fdf3e9;border-color:var(--espresso);}

.rating-slider{display:flex;align-items:center;gap:14px;}
.rating-slider input[type=range]{flex:1;accent-color:var(--accent);height:6px;}
.rating-num{
  font-family:'Fraunces',serif;font-weight:600;font-size:24px;color:var(--espresso);
  min-width:54px;height:50px;border-radius:13px;background:var(--surface-2);display:flex;align-items:center;justify-content:center;
}
.subrating{display:flex;align-items:center;justify-content:space-between;padding:9px 0;border-bottom:1px solid var(--line);}
.subrating:last-child{border-bottom:none;}
.subrating .sr-label{font-weight:600;font-size:14px;color:var(--text);}
.stars{display:flex;gap:3px;}
.stars button{color:var(--crema);}
.stars button svg{width:21px;height:21px;}
.stars button.on{color:var(--gold);}

.photo-row{display:flex;gap:9px;flex-wrap:wrap;}
.photo-thumb{width:78px;height:78px;border-radius:12px;object-fit:cover;border:1px solid var(--line);position:relative;}
.photo-add{
  width:78px;height:78px;border-radius:12px;border:1.5px dashed var(--crema);display:flex;align-items:center;justify-content:center;
  color:var(--coffee-soft);background:var(--surface-2);
}
.photo-add svg{width:24px;height:24px;}
.photo-wrap{position:relative;}
.photo-wrap .rm{position:absolute;top:-6px;right:-6px;width:22px;height:22px;border-radius:50%;background:var(--danger);color:#fff;display:flex;align-items:center;justify-content:center;}
.photo-wrap .rm svg{width:13px;height:13px;}

/* ---------- Detail view ---------- */
.detail-photo{width:100%;height:230px;object-fit:cover;background:var(--surface-2);}
.detail-body{padding:18px;}
.detail-body h1{font-size:27px;color:var(--espresso);font-weight:600;letter-spacing:-.5px;line-height:1.15;}
.detail-addr{color:var(--text-soft);font-size:13.5px;margin-top:6px;display:flex;align-items:center;gap:5px;}
.detail-addr svg{width:15px;height:15px;}
.big-score{display:flex;align-items:center;gap:14px;margin:18px 0;}
.big-score .bs-num{font-family:'Fraunces',serif;font-size:42px;font-weight:600;color:var(--espresso);line-height:1;}
.big-score .bs-of{color:var(--text-soft);font-size:15px;}
.detail-section{margin-top:22px;}
.detail-section h4{font-size:13px;text-transform:uppercase;letter-spacing:.5px;color:var(--coffee);margin-bottom:9px;font-family:'Inter',sans-serif;font-weight:700;}
.detail-note{background:var(--surface);border:1px solid var(--line);border-radius:13px;padding:14px;font-size:14.5px;color:var(--text);line-height:1.55;}
.sub-list .subrating{border-color:var(--line);}
.fav-order{display:flex;align-items:center;gap:9px;background:var(--surface);border:1px solid var(--line);border-radius:13px;padding:13px 15px;}
.fav-order svg{width:20px;height:20px;color:var(--accent);flex-shrink:0;}
.fav-order .fo-label{font-size:11px;text-transform:uppercase;letter-spacing:.5px;color:var(--text-soft);}
.fav-order .fo-text{font-weight:600;color:var(--espresso);}
.detail-photos{display:flex;gap:9px;overflow-x:auto;padding-bottom:4px;}
.detail-photos img{width:130px;height:130px;border-radius:13px;object-fit:cover;flex-shrink:0;border:1px solid var(--line);}

/* ---------- Feed ---------- */
.feed-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:15px;margin-bottom:13px;}
.feed-head{display:flex;align-items:center;gap:11px;margin-bottom:11px;}
.avatar{width:42px;height:42px;border-radius:50%;background:var(--crema);color:var(--espresso);display:flex;align-items:center;justify-content:center;font-family:'Fraunces',serif;font-weight:600;font-size:16px;object-fit:cover;flex-shrink:0;overflow:hidden;}
.avatar.sm{width:34px;height:34px;font-size:13px;}
.avatar.lg{width:78px;height:78px;font-size:30px;}
.feed-head .fh-name{font-weight:600;color:var(--espresso);font-size:14.5px;}
.feed-head .fh-name button{font-weight:600;color:var(--espresso);}
.feed-head .fh-time{font-size:12px;color:var(--text-soft);}
.feed-action{font-size:14px;color:var(--text);margin-bottom:10px;}
.feed-action strong{color:var(--espresso);font-weight:600;}
.feed-cafe{display:flex;gap:12px;align-items:center;background:var(--surface-2);border-radius:13px;padding:11px;cursor:pointer;}
.feed-cafe img{width:58px;height:58px;border-radius:11px;object-fit:cover;flex-shrink:0;}
.feed-cafe .fc-info{flex:1;min-width:0;}
.feed-cafe .fc-name{font-weight:600;color:var(--espresso);font-family:'Fraunces',serif;font-size:15px;}
.feed-cafe .fc-addr{font-size:12px;color:var(--text-soft);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.feed-actions{display:flex;gap:8px;margin-top:11px;}
.feed-actions button{flex:1;display:flex;align-items:center;justify-content:center;gap:6px;padding:9px;border-radius:11px;background:var(--surface-2);color:var(--coffee);font-weight:600;font-size:13px;}
.feed-actions button:hover{background:var(--crema-light);}
.feed-actions button svg{width:16px;height:16px;}

/* ---------- Friends ---------- */
.howto{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:15px 16px;margin-bottom:14px;}
.howto-title{display:flex;align-items:center;gap:8px;font-weight:700;color:var(--espresso);font-size:14px;margin-bottom:10px;}
.howto-title svg{width:17px;height:17px;color:var(--accent);}
.howto-steps{list-style:none;counter-reset:step;margin:0 0 13px;padding:0;display:flex;flex-direction:column;gap:9px;}
.howto-steps li{position:relative;padding-left:30px;font-size:13px;color:var(--text);line-height:1.4;counter-increment:step;}
.howto-steps li::before{content:counter(step);position:absolute;left:0;top:0;width:21px;height:21px;border-radius:50%;background:var(--crema-light);color:var(--espresso);font-weight:700;font-size:11.5px;display:flex;align-items:center;justify-content:center;}
.howto-steps li strong{color:var(--espresso);font-weight:600;}
.copy-field{display:flex;gap:8px;align-items:stretch;}
.copy-field .input{flex:1;font-size:13px;}
.copy-field .btn{flex-shrink:0;white-space:nowrap;}
.invite-actions{display:grid;grid-template-columns:repeat(4,1fr);gap:9px;margin-top:6px;}
.invite-opt{display:flex;flex-direction:column;align-items:center;gap:6px;padding:13px 6px;border:1px solid var(--line);border-radius:13px;background:var(--surface);color:var(--coffee);font-weight:600;font-size:11.5px;transition:.15s;}
.invite-opt:hover{background:var(--surface-2);border-color:var(--crema);}
.invite-opt svg{width:21px;height:21px;color:var(--accent);}
.handle-card{display:flex;align-items:center;gap:12px;padding:13px 15px;background:var(--espresso);border-radius:14px;margin-bottom:16px;}
.handle-card .hc-label{font-size:11px;color:var(--crema);text-transform:uppercase;letter-spacing:.4px;font-weight:600;}
.handle-card .hc-handle{font-family:'Fraunces',serif;font-size:19px;color:#fdf3e9;font-weight:600;margin-top:2px;}
.handle-card .copy-handle{color:var(--crema-light);}
.handle-card .copy-handle:hover{background:rgba(255,255,255,.1);}
.search-results .sr.sr-user{display:flex;align-items:center;gap:10px;}
.search-results .sr-info{flex:1;min-width:0;overflow:hidden;}
.search-results .sr-info strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.search-results .sr-info div{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.search-results .sr .btn.add{flex-shrink:0;width:auto;}
.search-results .sr-status{flex-shrink:0;}
.user-row{display:flex;align-items:center;gap:12px;padding:12px;background:var(--surface);border:1px solid var(--line);border-radius:14px;margin-bottom:10px;}
.user-row .ur-info{flex:1;min-width:0;}
.user-row .ur-name{font-weight:600;color:var(--espresso);font-size:14.5px;}
.user-row .ur-sub{font-size:12.5px;color:var(--text-soft);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.user-row .ur-actions{display:flex;gap:7px;flex-shrink:0;}

/* ---------- Chat ---------- */
.chat-view{display:flex;flex-direction:column;flex:1;min-height:0;}
.chat-header{display:flex;align-items:center;gap:11px;padding:12px 16px;border-bottom:1px solid var(--line);background:var(--surface);position:sticky;top:0;z-index:5;}
.chat-header .ch-name{font-weight:600;color:var(--espresso);font-size:16px;}
.chat-msgs{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:8px;}
.bubble{max-width:78%;padding:9px 13px;border-radius:16px;font-size:14.5px;line-height:1.4;word-wrap:break-word;}
.bubble.me{align-self:flex-end;background:var(--espresso);color:#fdf3e9;border-bottom-right-radius:5px;}
.bubble.them{align-self:flex-start;background:var(--surface);border:1px solid var(--line);color:var(--text);border-bottom-left-radius:5px;}
.bubble .ctx{font-size:11.5px;opacity:.8;margin-bottom:4px;padding-bottom:4px;border-bottom:1px solid rgba(255,255,255,.18);display:flex;align-items:center;gap:5px;}
.bubble.them .ctx{border-color:var(--line);color:var(--coffee);}
.bubble .ctx svg{width:13px;height:13px;}
.msg-time{font-size:10px;opacity:.55;margin-top:3px;text-align:right;}
.chat-input{display:flex;gap:9px;padding:10px 12px calc(10px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--surface);}
.chat-input input{flex:1;padding:11px 15px;border:1px solid var(--line);border-radius:22px;background:var(--surface-2);outline:none;}
.chat-input input:focus{background:#fff;border-color:var(--crema);}
.chat-input button{width:44px;height:44px;border-radius:50%;background:var(--accent);color:#fff;display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.chat-input button svg{width:20px;height:20px;}
.chat-context-banner{display:flex;align-items:center;gap:8px;padding:9px 14px;background:var(--crema-light);font-size:12.5px;color:var(--espresso);border-bottom:1px solid var(--line);}
.chat-context-banner svg{width:15px;height:15px;}
.chat-context-banner button{margin-left:auto;color:var(--coffee);}

/* ---------- Passport / Profile ---------- */
.profile-head{display:flex;flex-direction:column;align-items:center;text-align:center;padding:8px 0 18px;}
.profile-head h2{font-size:24px;color:var(--espresso);margin-top:12px;font-weight:600;}
.profile-head .ph-user{color:var(--text-soft);font-size:13.5px;}
.profile-head .ph-bio{color:var(--text);font-size:13.5px;margin-top:8px;max-width:300px;}
.stat-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:6px 0 20px;}
.stat{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:15px 10px;text-align:center;}
.stat .st-num{font-family:'Fraunces',serif;font-size:26px;font-weight:600;color:var(--espresso);line-height:1;}
.stat .st-lbl{font-size:11px;color:var(--text-soft);margin-top:5px;text-transform:uppercase;letter-spacing:.4px;font-weight:600;}
.passport-section{margin-top:6px;}
.passport-section h4{font-size:13px;text-transform:uppercase;letter-spacing:.5px;color:var(--coffee);margin-bottom:10px;font-weight:700;}
.roaster-row{display:flex;align-items:center;justify-content:space-between;padding:11px 14px;background:var(--surface);border:1px solid var(--line);border-radius:12px;margin-bottom:8px;}
.roaster-row .rr-name{font-weight:600;color:var(--espresso);display:flex;align-items:center;gap:9px;}
.roaster-row .rr-name svg{width:16px;height:16px;color:var(--coffee-soft);}
.roaster-row .rr-count{font-size:12.5px;color:var(--text-soft);font-weight:600;}

.spinner{width:30px;height:30px;border:3px solid var(--crema-light);border-top-color:var(--coffee);border-radius:50%;animation:spin .7s linear infinite;margin:40px auto;}
@keyframes spin{to{transform:rotate(360deg);}}

.toast{
  position:fixed;bottom:96px;left:50%;transform:translateX(-50%) translateY(20px);
  background:var(--espresso);color:#fdf3e9;padding:11px 18px;border-radius:12px;font-size:13.5px;font-weight:500;
  z-index:6000;opacity:0;transition:.25s;pointer-events:none;max-width:90%;text-align:center;
}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0);}

.divider{height:1px;background:var(--line);margin:18px 0;}
.link-btn{color:var(--accent-dark);font-weight:600;font-size:13.5px;}
.back-btn{display:flex;align-items:center;gap:5px;color:var(--coffee);font-weight:600;font-size:14px;padding:6px 0;}
.back-btn svg{width:18px;height:18px;}

@media(min-width:620px){
  .cafe-card .cc-photo{height:180px;}
}

/* ---------- Desktop: side navigation rail ---------- */
@media(min-width:900px){
  #app{flex-direction:row;}
  .shell{order:2;}
  .bottom-nav{order:1;}
  .fab{bottom:28px;right:28px;}
  /* hide the mobile top bar; the rail + content header take over */
  .topbar{display:none;}

  .bottom-nav{
    flex-direction:column;justify-content:flex-start;
    width:248px;flex-shrink:0;height:100%;
    border-top:none;border-right:1px solid var(--line);
    padding:18px 14px;gap:4px;overflow-y:auto;
  }
  .nav-brand{
    display:flex;align-items:center;gap:10px;
    font-family:'Fraunces',serif;font-size:22px;font-weight:600;color:var(--espresso);
    padding:6px 12px 18px;letter-spacing:-.3px;
  }
  .nav-brand svg{width:24px;height:24px;color:var(--coffee);}

  .nav-item{
    flex:none;flex-direction:row;justify-content:flex-start;gap:13px;
    padding:11px 14px;font-size:14.5px;border-radius:12px;transition:background .15s,color .15s;
  }
  .nav-item span{font-size:14.5px;}
  .nav-item svg{width:20px;height:20px;}
  .nav-item:hover{background:var(--surface-2);}
  .nav-item.active{background:var(--crema-light);color:var(--espresso);}
  .nav-item.active svg{transform:none;}
  .nav-item .nav-badge{position:static;margin:0 0 0 auto;min-width:18px;height:18px;font-size:10px;border-radius:9px;}

  /* desktop messages button lives in the rail */
  .nav-messages{
    display:flex;align-items:center;gap:13px;padding:11px 14px;border-radius:12px;
    color:var(--text-soft);font-weight:600;font-size:14.5px;width:100%;position:relative;transition:background .15s;
  }
  .nav-messages:hover{background:var(--surface-2);}
  .nav-messages svg{width:20px;height:20px;}
  .nav-messages .badge-dot{position:static;margin-left:auto;border:none;}

  .nav-spacer{display:block;flex:1;min-height:10px;}
  .nav-profile{
    display:flex;align-items:center;gap:11px;padding:10px 12px;border-radius:12px;
    border:1px solid var(--line);background:var(--surface);cursor:pointer;transition:border-color .15s;
  }
  .nav-profile:hover{border-color:var(--crema);}
  .nav-profile .np-info{min-width:0;text-align:left;}
  .nav-profile .np-name{font-weight:600;color:var(--espresso);font-size:13.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  .nav-profile .np-handle{font-size:11.5px;color:var(--text-soft);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}

  .view-pad{padding:30px 26px 60px;max-width:760px;}
  .view.map-mode{overflow:hidden;}

  /* sheets behave as centered dialogs on desktop */
  .overlay:not(.center){align-items:center;}
  .overlay:not(.center) .sheet{
    border-radius:20px;max-width:560px;max-height:90vh;
    transform:translateY(20px) scale(.98);
  }
  .overlay:not(.center).show .sheet{transform:translateY(0) scale(1);}
  .overlay:not(.center) .sheet .sheet-grab{display:none;}
}

@media(min-width:1200px){
  .view-pad{max-width:860px;}
}
