/* ============================================================
   Salapat v2 — unified messaging hub + renter/owner IA.
   Builds on the existing tokens.css (same warm palette). Only
   adds the few helper vars tokens.css doesn't define, then the
   new component styles. Base.css still handles buttons/cards.
   ============================================================ */
:root {
  --accent-soft:#F0E7DA; --danger:#B3402E;
  --radius:12px; --radius-lg:18px; --pill:100px;
}
:root[data-theme=dark]{ --accent-soft:#332F27; --danger:#E5836F; }

.ico { width:20px; height:20px; stroke:currentColor; fill:none; stroke-width:1.75; stroke-linecap:round; stroke-linejoin:round; flex:none; }
.ico-sm{ width:16px; height:16px; }
.ico-lg{ width:24px; height:24px; }

/* ---------- App bar (replaces .nav) ---------- */
.appbar { position:sticky; top:0; z-index:40; background:var(--bg); border-bottom:1px solid var(--border);
  display:flex; align-items:center; gap:20px; padding:12px 24px; max-width:1180px; margin:0 auto; }
.brand { font:600 24px var(--font-serif); color:var(--ink); text-decoration:none; letter-spacing:-.01em; }
.brand .logo-dot{ color:var(--amber); }
.topnav { display:flex; align-items:center; gap:2px; margin-left:auto; }
.topnav a { text-decoration:none; color:var(--ink-soft); font-weight:600; font-size:14.5px; padding:8px 12px; border-radius:10px; display:flex; align-items:center; gap:7px; position:relative; }
.topnav a:hover { background:var(--row-hover); color:var(--ink); }
.topnav a.active { color:var(--ink); background:var(--surface-alt); }
.topnav a .ico { width:18px; height:18px; }
.appbar-actions { display:flex; align-items:center; gap:10px; }
.iconbtn { width:38px; height:38px; display:grid; place-items:center; border-radius:var(--pill); border:1px solid var(--border-strong); background:var(--surface); color:var(--ink); cursor:pointer; }
.iconbtn:hover { background:var(--row-hover); }
.nav-badge { position:absolute; top:2px; right:4px; min-width:17px; height:17px; padding:0 4px; border-radius:var(--pill); background:var(--red); color:#fff; font-size:10.5px; font-weight:700; display:grid; place-items:center; line-height:1; }
.tabs { display:flex; gap:6px; align-items:center; margin-bottom:16px; flex-wrap:wrap; }
.tab { position:relative; border:1px solid var(--border-strong); background:var(--surface); color:var(--ink-soft);
       font:600 13.5px var(--font-sans); padding:7px 16px; border-radius:var(--pill); cursor:pointer;
       text-decoration:none; display:inline-flex; align-items:center; gap:6px; }
.tab:hover { color:var(--ink); }
.tab.on { background:var(--surface-alt); color:var(--ink); border-color:transparent; }
.tab .nav-badge { top:-7px; right:-7px; }
.lang-toggle { color:var(--ink-soft); text-decoration:none; font-weight:600; font-size:13px; padding:6px 8px; }
.theme-toggle { border:1px solid var(--border-strong); background:var(--surface); color:var(--ink); border-radius:100px; width:34px; height:34px; cursor:pointer; }
.avatar-btn { width:34px; height:34px; border-radius:50%; border:none; background:var(--gradient); color:#21231F;
              font:700 14px var(--font-sans); cursor:pointer; display:grid; place-items:center; }

.botnav { display:none; }

/* ---------- Profile menu ---------- */
.profilemenu { position:fixed; right:24px; top:64px; z-index:250; min-width:230px; background:var(--surface);
  border:1px solid var(--border); border-radius:14px; box-shadow:0 16px 40px var(--panel-shadow); padding:8px; display:none; }
.profilemenu.open { display:block; }
.profilemenu .pm-head { display:flex; gap:11px; align-items:center; padding:10px 12px 12px; border-bottom:1px solid var(--border); margin-bottom:6px; }
.profilemenu .pm-name { font-weight:700; color:var(--ink); font-size:14.5px; }
.profilemenu .pm-sub { color:var(--ink-soft); font-size:12px; }
.profilemenu a { display:flex; gap:10px; align-items:center; padding:10px 12px; border-radius:9px; text-decoration:none; color:var(--ink); font-weight:600; font-size:14px; }
.profilemenu a:hover { background:var(--row-hover); }
.profilemenu a .ico { width:17px; height:17px; color:var(--ink-soft); }
.profilemenu .pm-sep { height:1px; background:var(--border); margin:6px; }
.profilemenu .pm-out { color:var(--danger); }
.profilemenu .pm-out .ico { color:var(--danger); }

/* ---------- Chips / avatars ---------- */
.chip { display:inline-flex; align-items:center; gap:6px; font-size:12.5px; font-weight:600; padding:4px 11px; border-radius:var(--pill); background:var(--surface-alt); color:var(--ink-body); border:1px solid var(--border); }
.chip .ico { width:13px; height:13px; stroke-width:2; }
.chip-amber { background:color-mix(in srgb,var(--amber) 18%, transparent); color:var(--amber); border-color:color-mix(in srgb,var(--amber) 30%, transparent); }
.chip-green { background:color-mix(in srgb,var(--positive) 16%, transparent); color:var(--positive); border-color:color-mix(in srgb,var(--positive) 30%, transparent); }
.chip-quiet { background:transparent; }
.sdot { width:8px; height:8px; border-radius:50%; flex:none; display:inline-block; }
.sdot-amber{ background:var(--amber);} .sdot-green{ background:var(--positive);} .sdot-ink{ background:var(--ink-soft);}
.avatar { width:44px; height:44px; border-radius:50%; flex:none; display:grid; place-items:center; font:600 16px var(--font-serif); color:#fff; background:var(--ink-soft); overflow:hidden; }
.avatar-system { background:var(--gradient); color:#21231F; }
.verified { display:inline-grid; place-items:center; width:15px; height:15px; border-radius:50%; background:var(--positive); color:#fff; }
.verified .ico { width:10px; height:10px; stroke-width:3; }

/* ============================================================
   Messages hub
   ============================================================ */
.hub { display:grid; grid-template-columns:360px 1fr; border:1px solid var(--border); border-radius:var(--radius-lg); overflow:hidden; background:var(--surface); box-shadow:0 10px 30px var(--card-shadow); min-height:600px; }
.hub-list { border-right:1px solid var(--border); background:var(--surface); min-width:0; }
.hub-head { padding:16px 16px 12px; border-bottom:1px solid var(--border); }
.hub-search { display:flex; align-items:center; gap:8px; background:var(--surface-alt); border:1px solid var(--border); border-radius:var(--pill); padding:8px 14px; color:var(--ink-soft); }
.hub-search input { border:none; background:transparent; outline:none; color:var(--ink); font:14.5px var(--font-sans); width:100%; }
.hubrow { display:flex; gap:12px; padding:14px 16px; text-decoration:none; color:inherit; border-bottom:1px solid var(--border); align-items:flex-start; }
.hubrow:hover { background:var(--row-hover); }
.hubrow.unread { background:color-mix(in srgb,var(--amber) 6%, transparent); }
.hubrow-body { min-width:0; flex:1; }
.hubrow-top { display:flex; align-items:center; gap:8px; }
.hubrow-name { font-weight:700; color:var(--ink); font-size:14.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.hubrow-time { margin-left:auto; font-size:11.5px; color:var(--ink-soft); flex:none; }
.hubrow-preview { color:var(--ink-soft); font-size:13px; margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.hubrow-meta { display:flex; align-items:center; gap:8px; margin-top:7px; }
.pill-count { min-width:20px; height:20px; padding:0 6px; border-radius:var(--pill); background:var(--amber); color:#211; font-size:11px; font-weight:700; display:grid; place-items:center; margin-left:auto; }
.hub-empty { display:grid; place-content:center; text-align:center; gap:8px; color:var(--ink-soft); padding:40px; }

/* Thread pane */
.thread { display:flex; flex-direction:column; min-width:0; background:var(--bg); }
.thread-head { display:flex; align-items:center; gap:12px; padding:14px 20px; border-bottom:1px solid var(--border); background:var(--surface); }
.thread-head .back { display:none; }
.thread-head > .th-id { min-width:0; flex:1; }
.thread-title { font-weight:700; color:var(--ink); font-size:15.5px; display:flex; align-items:center; gap:7px; white-space:nowrap; }
.thread-head .muted { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.thread-scroll { flex:1; overflow-y:auto; padding:18px 20px; display:flex; flex-direction:column; gap:14px; max-height:70vh; }

.bookingcard { border:1px solid var(--border); border-radius:var(--radius); background:var(--surface); overflow:hidden; box-shadow:0 3px 10px var(--card-shadow); }
.bookingcard-top { display:flex; gap:14px; padding:16px; align-items:center; }
.bookingcard-thumb { width:60px; height:60px; border-radius:10px; object-fit:cover; flex:none; background:var(--surface-alt); }
.bookingcard-title { font-weight:700; color:var(--ink); font-size:15.5px; }
.bookingcard-sub { color:var(--ink-soft); font-size:13px; margin-top:2px; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.bookingcard-rows { border-top:1px solid var(--border); padding:12px 16px; font-size:13.5px; }
.brow { display:flex; justify-content:space-between; padding:3px 0; color:var(--ink-body); }
.brow.total { font-weight:700; color:var(--ink); border-top:1px solid var(--border); margin-top:6px; padding-top:9px; }
.brow .num { font-variant-numeric:tabular-nums; }
.bookingcard-cta { border-top:1px solid var(--border); padding:12px 16px; display:flex; gap:10px; align-items:center; flex-wrap:wrap; }

.daysep { text-align:center; font-size:11.5px; color:var(--ink-soft); font-weight:600; }
.sysmsg-event { align-self:stretch; border-radius:12px; padding:12px 14px; background:var(--surface); border:1px solid var(--border); display:flex; gap:11px; align-items:flex-start; }
.sysmsg-event .badge-ico { width:32px; height:32px; border-radius:50%; background:var(--gradient); color:#211; display:grid; place-items:center; flex:none; }
.sysmsg-event .badge-ico .ico { width:16px; height:16px; }
.sysmsg-event .t { font-weight:600; color:var(--ink); font-size:13.5px; }
.sysmsg-event .d { color:var(--ink-soft); font-size:12.5px; margin-top:2px; }
.sysmsg-event .when { margin-left:auto; font-size:11.5px; color:var(--ink-soft); flex:none; }

.bubble { max-width:76%; padding:10px 14px; border-radius:16px; font-size:14.5px; line-height:1.45; }
.bubble .time { font-size:10.5px; color:var(--ink-soft); margin-top:4px; }
.bubble.them { align-self:flex-start; background:var(--surface); border:1px solid var(--border); border-bottom-left-radius:5px; }
.bubble.me { align-self:flex-end; background:var(--gradient); color:#21231F; border-bottom-right-radius:5px; }
.bubble.me .time { color:#4a4a44; text-align:right; }

.composer { display:flex; gap:10px; padding:14px 18px; border-top:1px solid var(--border); background:var(--surface); align-items:center; }
.composer input { flex:1; border:1px solid var(--border-strong); border-radius:var(--pill); padding:11px 16px; background:var(--bg); color:var(--ink); font:15px var(--font-sans); outline:none; }
.composer input:focus { border-color:var(--amber); }
.composer .send { width:44px; height:44px; border-radius:50%; border:none; background:var(--gradient); color:#211; display:grid; place-items:center; cursor:pointer; flex:none; }

/* ---------- Browse: Recommended / All tabs ---------- */
.section-head { display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin-bottom:16px; }
.section-head .sh-title { font-weight:700; color:var(--ink); font-size:18px; }
.seg { display:flex; background:var(--surface-alt); border:1px solid var(--border); border-radius:var(--pill); padding:3px; }
.seg a, .seg button { border:none; background:transparent; color:var(--ink-soft); font:600 13px var(--font-sans); padding:6px 14px; border-radius:var(--pill); cursor:pointer; text-decoration:none; }
.seg a.on, .seg button.on { background:var(--surface); color:var(--ink); box-shadow:0 1px 3px var(--card-shadow); }
.textlist { border:1px solid var(--border); border-radius:var(--radius); background:var(--surface); box-shadow:0 4px 14px var(--card-shadow); overflow:hidden; }
.textrow { display:flex; justify-content:space-between; align-items:center; gap:14px; padding:15px 18px; border-bottom:1px solid var(--border); text-decoration:none; color:inherit; }
.textrow:last-child { border-bottom:none; }
.textrow:hover { background:var(--row-hover); }
.textrow .tt { font-weight:700; color:var(--ink); font-size:15px; }
.textrow .tm { color:var(--ink-soft); font-size:13px; margin-top:2px; }
.textrow .tr { text-align:right; flex:none; }
.textrow .price { font:500 17px var(--font-serif); color:var(--ink); font-variant-numeric:tabular-nums; }
.textrow .price small { font:500 12px var(--font-sans); color:var(--ink-soft); }

/* Responsive listing grid (class, NOT inline — escapes base.css's inline
   grid-template-columns !important phone-collapse). Phone-first: 2 up. */
.listing-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:11px; }
@media (min-width:640px){ .listing-grid { grid-template-columns:repeat(3,1fr); gap:14px; } }
@media (min-width:960px){ .listing-grid { grid-template-columns:repeat(4,1fr); gap:17px; } }

/* ============================================================
   Responsive (phone-first)
   ============================================================ */
@media (max-width:860px){
  .hub { grid-template-columns:1fr; min-height:auto; }
  .hub[data-view=thread] .hub-list { display:none; }
  .hub[data-view=list] .thread { display:none; }
  .thread-head .back { display:grid; place-items:center; }
}
.mobile-fab { display:none; }
@media (max-width:760px){
  .topnav { display:none; }
  /* Profile lives in the bottom bar on mobile — the top-right avatar button is desktop-only. */
  .avatar-btn { display:none; }
  .appbar { padding:12px 16px; }
  .botnav { display:flex; position:fixed; bottom:0; left:0; right:0; z-index:60; background:var(--surface);
    border-top:1px solid var(--border); padding:8px 6px calc(8px + env(safe-area-inset-bottom)); justify-content:space-around; }
  .botnav a { flex:1; display:flex; flex-direction:column; align-items:center; gap:3px; text-decoration:none; color:var(--ink-soft); font-size:10.5px; font-weight:600; padding:4px 2px; border-radius:10px; position:relative; min-height:48px; justify-content:center; }
  .botnav a.active { color:var(--ink); }
  .botnav a.active .ico { color:var(--amber); }
  .botnav .ico { width:23px; height:23px; }
  .botnav .nav-badge { top:0; right:calc(50% - 20px); }
  .profilemenu { left:12px; right:12px; top:auto; bottom:calc(70px + env(safe-area-inset-bottom)); }
  /* Floating shortcut to start a listing, pinned into the header's top-right corner — the space
     the desktop nav links (.topnav) vacate once hidden on mobile. Visible whether logged in or
     out (guest tap → /login, member tap → the guided listing chat). */
  .mobile-fab { display:flex; align-items:center; gap:6px; position:fixed; top:9px; right:16px;
    z-index:41; padding:9px 14px 9px 11px;
    border-radius:var(--pill); background:var(--gradient); color:#21231F; font-weight:700;
    font-size:13px; text-decoration:none; box-shadow:0 4px 12px var(--panel-shadow); }
  .mobile-fab .ico { width:17px; height:17px; }
  input, textarea, select, .btn, button { font-size:16px; }
}
