/* Contact needs room for conversation, without nested clipping of the composer. */
body.passenger-active-ride-map-active #boardGrid:has(#rideActionPanel #chatForm:not([hidden])),
body.rider-active-ride-map-active #boardGrid:has(#rideActionPanel #chatForm:not([hidden])) {
  display: flex !important; flex-direction: column;
  height: min(88dvh, 700px) !important; max-height: min(88dvh, 700px) !important;
  overflow: hidden !important;
}
body.passenger-active-ride-map-active #boardGrid:has(#rideActionPanel #chatForm:not([hidden])) > :not(#rideActionPanel),
body.rider-active-ride-map-active #boardGrid:has(#rideActionPanel #chatForm:not([hidden])) > :not(#rideActionPanel) { display: none !important; }
body.passenger-active-ride-map-active .board-grid.passenger-active-ride-mode #rideActionPanel:has(#chatForm:not([hidden])),
body.rider-active-ride-map-active .board-grid.rider-active-trip-mode #rideActionPanel:has(#chatForm:not([hidden])) {
  display: flex !important;
  flex-direction: column;
  height: min(88dvh, 700px);
  max-height: min(88dvh, 700px) !important;
  overflow: hidden !important;
}
#rideActionPanel:has(#chatForm:not([hidden])) > .px-matched-summary { flex: 0 0 auto; }
#rideActionPanel:has(#chatForm:not([hidden])) > .passenger-ride-tool-shell,
#rideActionPanel:has(#chatForm:not([hidden])) > .rider-ride-tool-shell {
  display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0;
}
#rideActionPanel:has(#chatForm:not([hidden])) .passenger-ride-dock { flex: 0 0 auto; }
body #rideActionPanel .passenger-ride-tool-content:has(#chatForm:not([hidden])) {
  display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0;
  max-height: none !important; overflow: hidden !important; gap: 8px;
}
#rideActionPanel .passenger-ride-tool-content:has(#chatForm:not([hidden])) > .ride-tool-panel { display: none; }
#rideActionPanel .passenger-ride-tool-content:has(#chatForm:not([hidden])) > .contact-actions { flex: 0 0 auto; }
#rideActionPanel .passenger-ride-tool-content #chatThread {
  display: flex; flex-direction: column; flex: 1 1 auto;
  min-height: 64px; max-height: min(32dvh, 280px); overflow-y: auto; gap: 8px;
}
body.passenger-active-ride-map-active #rideActionPanel .passenger-ride-tool-content #chatThread,
body.rider-active-ride-map-active #rideActionPanel .passenger-ride-tool-content #chatThread { max-height: none; }
#rideActionPanel .passenger-ride-tool-content #chatThread .chat-bubble { flex: 0 0 auto; }
#rideActionPanel .passenger-ride-tool-content #chatForm { flex: 0 0 auto; margin-top: 0; }

/* Explicit flex alignment: justify-self from the original grid has no effect here. */
#rideActionPanel .passenger-ride-tool-content #chatThread .chat-bubble { align-self: flex-start; }
#rideActionPanel .passenger-ride-tool-content #chatThread .chat-bubble.self { align-self: flex-end; }
/* Conversation and ride tools need an opaque reading surface over the map. */
body #rideActionPanel:has(.passenger-ride-tool-content:not([hidden])) {
  background: #f4faf8 !important;
  border-radius: 16px;
  padding: 8px;
}
body #rideActionPanel .passenger-ride-tool-shell,
body #rideActionPanel .rider-ride-tool-shell,
body #rideActionPanel .passenger-ride-tool-content { background: #f4faf8; }
body #rideActionPanel .passenger-ride-tool-content:has(#chatForm:not([hidden])) {
  width: 100%; align-self: stretch; box-sizing: border-box;
}

/* All matched tools use the same expanded sheet; only its content scrolls. */
body.passenger-active-ride-map-active #boardGrid:has(#rideActionPanel[data-ride-tool-panel]:not([data-ride-tool-panel=""])),
body.waka-app-workspace #boardGrid:has(#rideActionPanel[data-ride-tool-panel]:not([data-ride-tool-panel=""])) {
  display: flex !important; flex-direction: column;
  height: min(88dvh, 700px) !important; max-height: min(88dvh, 700px) !important;
  overflow: hidden !important;
}
body.passenger-active-ride-map-active #boardGrid:has(#rideActionPanel[data-ride-tool-panel]:not([data-ride-tool-panel=""])) > :not(#rideActionPanel),
body.waka-app-workspace #boardGrid:has(#rideActionPanel[data-ride-tool-panel]:not([data-ride-tool-panel=""])) > :not(#rideActionPanel) { display: none !important; }
body.passenger-active-ride-map-active #rideActionPanel[data-ride-tool-panel]:not([data-ride-tool-panel=""]),
body.waka-app-workspace #rideActionPanel[data-ride-tool-panel]:not([data-ride-tool-panel=""]) {
  display: flex !important; flex-direction: column;
  height: min(88dvh, 700px); max-height: min(88dvh, 700px) !important;
  overflow: hidden !important;
}
body #rideActionPanel[data-ride-tool-panel]:not([data-ride-tool-panel=""]) > .px-matched-summary { flex: 0 0 auto; }
body #rideActionPanel[data-ride-tool-panel]:not([data-ride-tool-panel=""]) > :is(.passenger-ride-tool-shell,.rider-ride-tool-shell) {
  display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0;
}
body #rideActionPanel[data-ride-tool-panel]:not([data-ride-tool-panel=""]):not([data-ride-tool-panel="contact"]) .passenger-ride-tool-content {
  width: 100%; flex: 1 1 auto; min-height: 0; max-height: none !important;
  overflow-y: auto !important; overscroll-behavior: contain;
}

/* Calm, colorful surfaces with clear action and warning colors. */
body.waka-app-workspace {
  background: linear-gradient(145deg,#edf9f5 0%,#eef3ff 55%,#faf3ff 100%);
}
#riderWorkspaceHeader, #passengerWorkspaceHeader {
  background: linear-gradient(115deg,#e0f6ef,#e2edff 65%,#f1e6fc);
  border: 1px solid #b7d9d5; border-radius:20px;
}
#requestsBoard, #offersBoard, .px-matched-summary {
  border-color:#b9d7e8;
  box-shadow:0 8px 24px rgb(27 80 96 / 7%);
}
.px-matched-summary {background:linear-gradient(120deg,#dff5ee,#e6efff 72%,#f1e8fa) !important;}
body #rideActionPanel:has(.passenger-ride-tool-content:not([hidden])) {
  background:linear-gradient(160deg,#f0faf7,#f2f4ff) !important;
  border:1px solid #bcd6e6;
}
body #rideActionPanel .passenger-ride-tool-shell,
body #rideActionPanel .rider-ride-tool-shell {background:transparent;}
body #rideActionPanel .passenger-ride-tool-content {background:#f6fafc;border-radius:14px;}
#rideActionPanel .ride-tool-toolbar {display:flex;justify-content:flex-end;flex:0 0 auto;padding:4px 2px 8px;}
#rideActionPanel .ride-tool-minimize {
  min-height:40px; padding:8px 14px; border:1px solid #aaa4d7;
  border-radius:999px; color:#443c78; background:#f0edff;
  font-size:14px; font-weight:700; box-shadow:none; cursor:pointer;
}
#rideActionPanel .ride-tool-minimize:hover {background:#e4defb;}
#rideActionPanel .ride-tool-minimize:focus-visible {outline:3px solid #7a59c0;outline-offset:2px;}
#rideActionPanel .ride-tool-button {border-color:#bfd5df;background:#edf5fb;color:#204d64;}
#rideActionPanel .ride-tool-button:nth-child(2) {background:#f0edfc;color:#564377;}
#rideActionPanel .ride-tool-button:nth-child(3) {background:#e8f6ef;color:#175f51;}
#rideActionPanel .ride-tool-button:nth-child(4) {background:#fff6de;color:#79551a;}
#rideActionPanel .ride-tool-button.active {background:linear-gradient(120deg,#087f78,#176b9a);color:white;border-color:#08766e;box-shadow:0 3px 9px rgb(7 103 108 / 18%);}
#rideActionPanel .ride-tool-panel {border-left:4px solid #7681c5;background:#eef0fc;}
#rideActionPanel #chatThread {padding:10px; border-radius:14px;background:#f5f8fd;}
#rideActionPanel #chatThread .chat-bubble {background:#e2effc;border-color:#abc6e3;color:#173c56;border-radius:16px 16px 16px 4px;}
#rideActionPanel #chatThread .chat-bubble.self {background:#0d756f;border-color:#09665f;color:white;border-radius:16px 16px 4px 16px;}
#rideActionPanel #chatThread .chat-bubble.system {background:#f2edf9;color:#4a4161;}
.notice-popup {border-top:4px solid #b48b26;box-shadow:0 12px 28px rgb(40 63 90 / 16%);}
@media (prefers-reduced-motion:reduce) {#rideActionPanel * {scroll-behavior:auto !important;}}
