:root { --page-bg:#f5f5f7; --panel:#fff; --line:rgba(0,0,0,.08); --text:#1c1c1e; --muted:#6e6e73; --accent:#007aff; --fill:rgba(118,118,128,.12); --outgoing:#1c1c1e; --outgoing-text:#fff; }
html[data-theme="dark"] { --page-bg:#0c0c0e; --panel:#171719; --line:rgba(255,255,255,.1); --text:#fff; --muted:#a1a1a6; --fill:rgba(255,255,255,.07); --outgoing:#fff; --outgoing-text:#1c1c1e; }
body { margin:0; background:var(--page-bg); color:var(--text); font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
main *, main *::before, main *::after { box-sizing:border-box; }
main [hidden] { display:none !important; }
main { width:min(1120px,calc(100% - 36px)); margin:28px auto 40px; }
.heading { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:20px; }
h1 { font-size:28px; font-weight:700; letter-spacing:-.4px; margin:0; }
.heading a { color:var(--accent); font-size:14px; text-decoration:none; }
.shell { height:min(740px,calc(100dvh / var(--rb-page-scale,1) - 160px)); min-height:320px; display:grid; grid-template-columns:320px minmax(0,1fr); background:var(--panel); border:1px solid var(--line); border-radius:20px; overflow:hidden; }
.sidebar { min-width:0; min-height:0; border-right:1px solid var(--line); display:flex; flex-direction:column; }
.side-head { padding:18px 20px 12px; flex:none; }
.search-wrap { display:flex; align-items:center; gap:10px; padding:0 12px; border-radius:12px; background:var(--fill); margin-bottom:14px; }
.search-wrap svg { flex:none; width:18px; height:18px; color:var(--muted); }
.search { min-width:0; width:100%; height:44px; border:0; background:transparent; color:var(--text); padding:0; font:inherit; font-size:16px; outline:none; }
.search-wrap:focus-within { outline:2px solid var(--accent); outline-offset:2px; }
.search::placeholder,.composer textarea::placeholder { color:var(--muted); opacity:1; }
.tabs { display:flex; gap:3px; background:var(--fill); border-radius:12px; padding:4px; margin:0; }
.tab { flex:1; min-width:0; min-height:40px; border:0; border-radius:9px; background:transparent; color:var(--muted); padding:8px; font-family:inherit; font-weight:600; font-size:14px; line-height:20px; cursor:pointer; }
.tab.active { background:var(--panel); color:var(--text); box-shadow:0 1px 3px #0001; }
.conversations { overflow:auto; min-height:0; flex:1; overscroll-behavior:contain; }
.conversation { width:100%; display:flex; gap:13px; align-items:center; border:0; border-bottom:1px solid var(--line); padding:16px 20px; background:transparent; color:inherit; text-align:left; cursor:pointer; }
.conversation:hover,.conversation.selected { background:var(--fill); }
.avatar { width:48px; height:48px; flex:0 0 48px; border-radius:50%; display:grid; place-items:center; color:#fff; font-weight:700; background:#526d93; overflow:hidden; }
.avatar img { width:100%; height:100%; object-fit:cover; display:block; }
.conv-copy { min-width:0; flex:1; }
.conv-top { display:flex; gap:8px; align-items:baseline; }
.conv-name { flex:1; min-width:0; font-weight:600; font-size:16px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.conv-time { flex:none; color:var(--muted); font-size:11px; white-space:nowrap; }
.conv-preview { display:block; color:var(--muted); font-size:13px; line-height:20px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:3px; }
.conversation.has-unread .conv-preview { color:var(--text); font-weight:500; }
.unread { width:8px; height:8px; border-radius:50%; background:var(--accent); flex:0 0 8px; }
.empty-list { padding:32px 22px; color:var(--muted); font-size:14px; line-height:1.6; text-align:center; }
.empty-list a { color:var(--accent); font-weight:600; }
.thread { position:relative; min-width:0; min-height:0; display:flex; flex-direction:column; }
html[data-language] .thread-head, .thread-head { flex:none; min-height:74px; padding:12px 16px; display:grid; grid-template-columns:44px minmax(0,1fr) 44px; align-items:center; gap:12px; border-bottom:1px solid var(--line); background:var(--panel); z-index:2; }
.thread-head .avatar { width:44px; height:44px; }
.thread-title { min-width:0; }
.thread-title strong { display:block; font-size:15px; font-weight:700; line-height:21px; overflow-wrap:anywhere; }
.thread-title small { display:block; color:var(--muted); font-size:12px; line-height:18px; margin-top:2px; }
.icon-button { width:44px; height:44px; padding:0; border:0; border-radius:50%; background:var(--fill); color:var(--text); display:grid; place-items:center; cursor:pointer; }
.icon-button svg { width:22px; height:22px; }
.back { display:none; }
.thread-menu { position:relative; }
.thread-menu summary { list-style:none; }
.thread-menu summary::-webkit-details-marker { display:none; }
html[data-language] .thread-menu .thread-actions, .thread-menu .thread-actions { position:absolute; right:0; top:50px; display:grid; gap:4px; width:min(240px,calc(100vw - 32px)); padding:6px; border:1px solid var(--line); border-radius:16px; background:var(--panel); box-shadow:0 12px 36px #0003; z-index:3; }
.thread-actions > :is(button,a) { min-height:44px; display:flex; align-items:center; width:100%; border:0; border-radius:10px; background:transparent; color:var(--text); padding:10px 12px; font:inherit; font-size:14px; line-height:20px; text-align:left; text-decoration:none; cursor:pointer; white-space:normal; }
.thread-actions > :is(button,a):hover { background:var(--fill); }
.thread-actions > .delete { color:#e3342f; }
.messages { flex:1; min-height:0; overflow:auto; padding:18px 16px; display:flex; flex-direction:column; gap:8px; overscroll-behavior:contain; overflow-anchor:none; }
.day-label { flex:none; text-align:center; margin:12px 0 6px; color:var(--muted); font-size:11px; }
.message { flex:none; max-width:min(78%,560px); padding:12px 16px 9px; border-radius:18px; overflow-wrap:anywhere; white-space:pre-wrap; font-size:14px; line-height:21px; }
.message.mine { align-self:flex-end; background:var(--outgoing); color:var(--outgoing-text); border-bottom-right-radius:4px; }
.message.theirs { align-self:flex-start; background:var(--fill); color:var(--text); border:1px solid var(--line); border-bottom-left-radius:4px; }
.message time { display:block; margin-top:5px; text-align:right; font-size:10px; line-height:14px; opacity:.65; white-space:nowrap; }
.composer { flex:none; display:flex; align-items:flex-end; gap:8px; border-top:1px solid var(--line); background:var(--panel); padding:12px 16px max(12px,env(safe-area-inset-bottom)); }
.composer textarea { min-width:0; flex:1; resize:none; height:48px; min-height:48px; max-height:120px; border:1px solid var(--line); border-radius:22px; background:var(--fill); color:var(--text); padding:12px 16px; font:inherit; font-size:16px; line-height:21px; outline:none; }
.composer textarea:focus-visible { border-color:var(--accent); }
.send { width:44px; height:44px; flex:none; border:0; border-radius:50%; padding:0; background:var(--outgoing); color:var(--outgoing-text); display:grid; place-items:center; cursor:pointer; }
.send svg { width:22px; height:22px; }
.send:disabled { opacity:.35; cursor:default; }
.notice { flex:none; margin:0; padding:10px 16px; color:#d32f2f; font-size:13px; line-height:20px; }
.welcome { margin:auto; padding:30px; text-align:center; color:var(--muted); max-width:360px; line-height:1.6; }
.welcome svg { color:var(--text); width:44px; height:44px; margin-bottom:12px; }
.welcome strong { font-size:20px; color:var(--text); }
.new-messages { align-self:center; position:absolute; bottom:calc(var(--composer-height,72px) + 12px); z-index:1; padding:10px 16px; border:1px solid var(--line); border-radius:24px; background:var(--panel); color:var(--accent); font-family:inherit; font-weight:600; font-size:13px; line-height:20px; box-shadow:0 4px 16px #0002; cursor:pointer; }
main :is(button,a,summary):focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.retry { border:1px solid var(--line); border-radius:20px; background:var(--fill); color:var(--text); min-height:44px; padding:10px 22px; font:inherit; cursor:pointer; }
@media(max-width:720px) {
  main { width:100%; margin:20px 0 0; }
  .heading { margin:0 22px 18px; }
  .heading h1 { font-size:28px; }
  .heading a { font-size:12px; }
  .shell { display:block; height:auto; min-height:0; background:transparent; border:0; border-radius:0; }
  .sidebar { border:0; }
  .side-head { padding:0 22px 12px; }
  .conversation { padding:16px 22px; }
  .thread { display:none; }
  body.chat-open { overflow:hidden; }
  body.chat-open > :is(.nav,.nav-scrim,.nav-drawer,.rb-language-footer) { display:none !important; }
  body.chat-open main { position:fixed; top:var(--chat-top,0px); left:0; right:0; width:100%; height:var(--chat-height,100dvh); margin:0; z-index:60; }
  body.chat-open .heading { display:none; }
  .shell.thread-open { height:100%; background:var(--page-bg); }
  .shell.thread-open .sidebar { display:none; }
  .shell.thread-open .thread { display:flex; height:100%; }
  html[data-language] .thread-head, .thread-head { grid-template-columns:44px 40px minmax(0,1fr) 44px; gap:8px; padding:10px 12px; }
  .thread-head .avatar { width:40px; height:40px; }
  .back { display:grid; }
  .thread-head .thread-title strong { font-size:15px; }
  .composer { padding-left:12px; padding-right:12px; }
}
html[data-widget="true"],html[data-widget="true"] body { height:100%; overflow:hidden; }
html[data-widget="true"] body { padding:0; }
html[data-widget="true"] body > :is(.nav,.nav-scrim,.nav-drawer,.rb-language-footer),html[data-widget="true"] .heading { display:none !important; }
html[data-widget="true"] main { width:100%; height:100%; margin:0; }
html[data-widget="true"] .shell { height:100%; min-height:0; border:0; border-radius:0; grid-template-columns:1fr; }
html[data-widget="true"] .thread { display:none; }
html[data-widget="true"] .shell.thread-open .sidebar { display:none; }
html[data-widget="true"] .shell.thread-open .thread { display:flex; height:100%; }
html[data-widget="true"] body.chat-open main { position:static; }
@media(prefers-reduced-motion:reduce) { .messages { scroll-behavior:auto; } }

/* Values and hierarchy mirror MessagesScreen, ChatScreen and PartnerProfileScreen. */
:root { --page-bg:#f2f2f7; --panel:#fff; --incoming:#fff; --secondary:#6c6c70; }
html[data-theme="dark"] { --page-bg:#080808; --panel:#080808; --incoming:#161616; --line:rgba(255,255,255,.06); --secondary:#707070; --text:#fff; --outgoing:#fff; --outgoing-text:#080808; }
.heading { justify-content:center; position:relative; }
.heading a { position:absolute; right:0; }
.conversation { padding:14px 22px; gap:4px; }
.conversation-open { display:flex; align-items:center; gap:13px; min-width:0; flex:1; border:0; padding:0; background:transparent; color:inherit; text-align:left; font:inherit; cursor:pointer; }
.conversation-open:active { transform:scale(.974); }
.conversation-delete { flex:none; display:grid; place-items:center; width:32px; height:40px; padding:8px; border:0; background:transparent; color:var(--secondary); cursor:pointer; }
.conversation-delete svg { width:16px; height:16px; }
.avatar-wrap { position:relative; flex:none; }
.unread { position:absolute; top:1px; right:1px; width:11px; height:11px; border:2px solid var(--page-bg); background:var(--text); }
.blocked-pill { font-size:9px; color:var(--secondary); border-radius:8px; padding:2px 6px; background:var(--fill); text-transform:uppercase; }
.conv-preview { color:var(--secondary); }
.search { font-size:14px; }
.conversations[data-archived="true"] { opacity:.72; }
html[data-language] .thread-head,.thread-head { grid-template-columns:36px minmax(0,1fr) 36px; min-height:104px; padding:12px 16px; gap:0; background:var(--page-bg); }
.back { display:grid; width:36px; height:36px; border:1px solid rgba(214,222,236,.24); background:rgba(186,194,210,.14); }
.partner-link { grid-column:2; min-width:0; display:flex; flex-direction:column; align-items:center; gap:6px; padding:0; border:0; background:transparent; color:var(--text); cursor:pointer; font:inherit; }
.partner-link .avatar { width:38px; height:38px; flex-basis:38px; }
.thread-title { display:flex; align-items:center; justify-content:center; gap:3px; max-width:100%; }
.thread-title > span { color:var(--secondary); font-size:12px; }
.thread-title strong { font-size:15px; }
.messages { gap:8px; padding:16px; }
.message { max-width:78%; padding:0; margin:3px 0; border:0 !important; background:transparent !important; }
.bubble { border-radius:18px; padding:12px 16px; }
.mine .bubble { background:var(--outgoing); color:var(--outgoing-text); border-bottom-right-radius:4px; }
.theirs .bubble { background:var(--incoming); color:var(--text); border:1px solid var(--line); border-bottom-left-radius:4px; }
.message time { margin:4px 4px 0; color:var(--secondary); opacity:1; text-align:left; }
.message.mine time { text-align:right; }
.message.failed .bubble { opacity:.6; }
.message.failed { cursor:pointer; }
.retry-hint { color:#ff3b30; }
.message-status.seen { color:var(--accent); }
.composer { background:var(--page-bg); }
.send { width:40px; height:40px; background:#1a1a1e; color:var(--text); box-shadow:0 4px 8px #0006; }
.send:disabled { opacity:1; background:rgba(0,0,0,.12); color:var(--secondary); box-shadow:none; }
.composer textarea { max-height:100px; }
.quick-replies { flex:none; display:flex; gap:8px; padding:10px 12px; overflow-x:auto; border-top:1px solid var(--line); scrollbar-width:none; }
.quick-replies button { flex:none; border-radius:20px; padding:8px 14px; background:var(--incoming); color:var(--text); border:1px solid var(--line); font:inherit; font-size:13px; line-height:20px; cursor:pointer; }
.chat-banner { flex:none; padding:14px 20px max(8px,env(safe-area-inset-bottom)); border-top:1px solid var(--line); color:var(--secondary); font-size:13px; text-align:center; }
.partner-page { position:absolute; inset:0; z-index:5; background:var(--page-bg); display:flex; flex-direction:column; min-height:0; }
.profile-header { flex:none; display:flex; align-items:center; justify-content:space-between; padding:14px 16px; }
.profile-body { min-height:0; overflow:auto; padding:20px 24px 40px; text-align:center; }
.profile-avatar { width:110px; height:110px; margin:0 auto 16px; font-size:32px; }
.profile-body h2 { font-size:26px; margin:12px 0; overflow-wrap:anywhere; }
.profile-body p { font-size:14px; line-height:22px; color:var(--secondary); overflow-wrap:anywhere; }
.profile-stats { display:flex; justify-content:center; margin:24px 0; }
.profile-stats > span { display:flex; flex-direction:column; gap:6px; width:50%; font-size:13px; color:var(--secondary); }
.profile-stats > span + span { border-left:1px solid var(--line); }
.profile-stats strong { font-size:24px; color:var(--text); }
.profile-body .ride-link { display:block; color:var(--accent); padding:16px; }
#report-reasons { display:grid; gap:8px; }
#report-reasons button { min-height:44px; border:1px solid var(--line); border-radius:12px; background:var(--incoming); color:var(--text); padding:10px; font:inherit; cursor:pointer; }
@media(max-width:720px) {
  .heading { padding:8px 0 0; margin-bottom:12px; }
  .heading a { display:none; }
  html[data-language] .thread-head,.thread-head { grid-template-columns:36px minmax(0,1fr) 36px; padding:12px 16px; }
}

.profile-open > :not(.partner-page) { display:none !important; }
.message { font-weight:400; }
.action-confirm { position:fixed; inset:auto 12px max(12px,env(safe-area-inset-bottom)); width:calc(100% - 24px); max-width:500px; padding:0; border:1px solid var(--line); border-radius:16px; background:var(--incoming); color:var(--text); }
.action-confirm:not([open]) { display:none; }
.action-confirm::backdrop { background:rgba(0,0,0,.55); }
.action-confirm h2 { font-size:15px; font-weight:600; text-align:center; margin:14px 20px 4px; }
.action-confirm p { color:var(--secondary); font-size:13px; line-height:18px; text-align:center; margin:4px 20px 14px; }
.action-confirm button { width:100%; border:0; border-top:1px solid var(--line); padding:16px 20px; font:inherit; font-size:16px; color:var(--text); background:transparent; cursor:pointer; }
.action-confirm #confirm-accept { color:#ff3b30; }
.action-confirm button:last-child { border-top:6px solid var(--line); font-weight:600; }
@media(max-width:720px) {
  .thread-menu[open]::before { content:""; position:fixed; inset:0; background:rgba(0,0,0,.55); z-index:6; }
  html[data-language] .thread-menu .thread-actions,.thread-menu .thread-actions { position:fixed; inset:auto 12px max(12px,env(safe-area-inset-bottom)); width:auto; padding:0; gap:0; background:var(--incoming); z-index:7; overflow:hidden; }
  .thread-actions > :is(button,a) { border-radius:0; border-top:1px solid var(--line); justify-content:center; font-size:16px; padding:16px 20px; }
  .thread-actions > :is(#block-action,a[href="tel:911"]) { color:#ff3b30; }
  .thread-actions #safety-cancel { border-top:6px solid var(--line); font-weight:600; }
}
