:root {
  --ink: #203c32;
  --green: #296449;
  --muted: #748078;
  --line: #dce5db;
  --bg: #f6f7f2;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 system-ui;
}
button,
input,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  padding: 10px 15px;
  border-radius: 9px;
  color: inherit;
  background: white;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 30px;
  border-bottom: 1px solid var(--line);
}
header b {
  font-size: 24px;
  letter-spacing: -1px;
}
header b span {
  font-size: 12px;
  letter-spacing: 1px;
}
header small {
  flex: 1;
  color: var(--muted);
}
main {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  max-width: none;
  margin: auto;
  min-height: calc(100vh - 85px);
}
aside {
  padding: 18px 12px;
  border-right: 1px solid var(--line);
}
h2 {
  font-size: 17px;
}
.asideHead {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
}
.chat {
  padding: 30px 40px;
}
.composeRow {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin: 10px 0;
}
input,
textarea {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
}
textarea {
  resize: vertical;
  min-height: 85px;
}
.task {
  display: block;
  width: 100%;
  text-align: left;
  margin: 12px 0;
}
.task.active {
  background: #e4eee0;
  border-color: #9eafa0;
}
.task small {
  color: var(--muted);
  display: block;
}
.badge {
  float: right;
  background: var(--green);
  color: white;
  border-radius: 15px;
  padding: 0 6px;
}
.bubble {
  background: #eaf0e6;
  border-radius: 12px;
  padding: 17px 20px;
  margin: 16px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bubble.user {
  background: white;
  border: 1px solid var(--line);
  margin-left: 25px;
}
.bubble small {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 1px;
}
.panel {
  max-width: 480px;
  padding: 30px;
  margin: 50px auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 15px;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 15px 0;
}
.result {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  margin: 18px 0;
}
.result h3 {
  margin: 3px 0;
}
small,
.muted {
  color: var(--muted);
  font-size: 12px;
}
a {
  color: var(--green);
}
.reply {
  background: #eff3eb;
  padding: 12px;
  margin: 10px 0;
  border-radius: 8px;
}
#error {
  background: #fff0d4;
  padding: 14px 25px;
}
#progress {
  color: var(--green);
}
dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 25px;
  width: min(650px, 94vw);
  color: var(--ink);
}
dialog::backdrop {
  background: #17362d55;
}
#confirmation {
  padding: 20px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 12px;
}
#prepared {
  white-space: pre-wrap;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 3px solid #b6a169;
  outline-offset: 3px;
}
@media (max-width: 700px) {
  header {
    padding: 15px;
    flex-wrap: wrap;
  }
  main {
    display: block;
  }
  aside {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  #tasks {
    display: flex;
    overflow: auto;
    gap: 8px;
  }
  .task {
    min-width: 180px;
    max-width: 230px;
  }
  .chat {
    padding: 22px 15px;
  }
  .composeRow {
    display: block;
  }
  .composeRow button {
    margin-top: 8px;
  }
  .panel {
    margin: 20px;
  }
}
/* Persistent messenger: the answer box stays next to the ongoing dialogue. */
body {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
header {
  flex: none;
  padding: 16px 28px;
}
main {
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
aside {
  overflow-y: auto;
}
.chat {
  min-width: 0;
  min-height: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.chatHeading {
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
}
.chatHeading h2 {
  margin: 3px 0;
  max-width: 570px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chatHeading .actions {
  margin: 0;
  gap: 5px;
}
.chatHeading button {
  padding: 7px 10px;
  font-size: 12px;
}
#timeline {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px 30px;
  scroll-padding-top: 20px;
  overflow-wrap: anywhere;
}
#welcome {
  padding: 50px 5px;
  max-width: 570px;
}
#welcome h1 {
  font-size: 28px;
  line-height: 1.3;
  letter-spacing: -0.7px;
}
#compose {
  flex: none;
  padding: 12px 28px 18px;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
#compose label {
  margin: 0 0 7px;
  font-weight: 500;
}
#input {
  min-height: 60px;
  max-height: 150px;
  resize: none;
}
.composeRow {
  align-items: center;
}
.inputHint {
  display: block;
  margin-top: 6px;
}
.bubble {
  max-width: 90%;
  margin: 12px 0;
}
.bubble.user {
  margin-left: auto;
  max-width: 85%;
}
.result {
  padding: 16px;
  margin: 12px 0;
}
.result h3 {
  font-size: 17px;
}
.result p {
  margin: 7px 0;
}
summary {
  cursor: pointer;
  color: var(--green);
  font-size: 13px;
}
.moreResults {
  padding: 10px 0;
}
#progress {
  padding: 12px 16px;
  border-radius: 10px;
  background: #eaf0e6;
  max-width: 90%;
}
.thinking::before {
  content: "●";
  display: inline-block;
  margin-right: 9px;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}
@media (prefers-reduced-motion: reduce) {
  .thinking::before {
    animation: none;
  }
}
.panel {
  overflow: auto;
  flex: none;
  max-height: calc(100dvh - 120px);
  width: min(480px, 94vw);
}
@media (max-width: 700px) {
  header {
    padding: 10px 14px;
    gap: 8px;
  }
  header b {
    font-size: 21px;
  }
  header button {
    padding: 6px 9px;
    font-size: 12px;
  }
  main {
    display: flex;
    flex-direction: column;
  }
  aside {
    flex: none;
    padding: 4px 12px;
    max-height: 150px;
  }
  .asideHead h2 {
    font-size: 14px;
    margin: 4px 0;
  }
  .asideHead button {
    padding: 6px 9px;
  }
  #tasks {
    max-height: 78px;
  }
  .task {
    margin: 4px 0;
    padding: 6px 10px;
    font-size: 12px;
  }
  #confirmCurrent {
    display: none;
  }
  .chat {
    flex: 1;
  }
  .chatHeading {
    padding: 8px 14px;
  }
  .chatHeading h2 {
    max-width: 190px;
    font-size: 14px;
  }
  .chatHeading .actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .chatHeading small {
    font-size: 9px;
  }
  #timeline {
    padding: 12px 14px;
  }
  #compose {
    padding: 10px 14px;
  }
  .composeRow {
    display: flex;
  }
  .composeRow button {
    margin: 0;
    padding: 10px;
  }
  #input {
    min-height: 56px;
  }
  .inputHint {
    font-size: 10px;
  }
  .bubble {
    max-width: 96%;
    padding: 13px;
  }
  .bubble.user {
    max-width: 90%;
  }
  #welcome {
    padding: 10px 5px;
  }
  #welcome h1 {
    font-size: 23px;
  }
}
/* Search results and next actions are visually distinct from ordinary messages. */
.bubble.outcome {
  background: #234f40;
  color: #fff;
  border-left: 6px solid #dcb65b;
  padding: 22px 24px;
  font-size: 18px;
  font-weight: 600;
  box-shadow: 0 5px 15px #203c3212;
  max-width: 100%;
}
.bubble.outcome small {
  color: #e0d498;
  font-size: 11px;
  margin-bottom: 9px;
  letter-spacing: 1.5px;
}
.bubble.newPosition {
  border: 2px solid #3c7960;
  background: #e3f2e6;
  font-weight: 600;
}
.bubble.orderNotice {
  border-left: 5px solid #3c7960;
  font-weight: 600;
}
.orderCard {
  background: #fffdf5;
  border: 1px solid #dcca9b;
  border-radius: 13px;
  padding: 20px 24px;
  margin: 14px 0 22px;
}
.orderCard h3 {
  margin: 4px 0 10px;
  font-size: 20px;
}
.orderCard p {
  margin: 10px 0;
}
.orderCard blockquote {
  margin: 12px 0;
  border-left: 3px solid #c5ad76;
  padding: 8px 15px;
  background: #f5f3e9;
}
.orderCard details {
  margin: 10px 0;
}
.orderCard pre {
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f4f5ee;
  padding: 14px;
  border-radius: 8px;
  font-size: 13px;
}
.orderCard.published {
  background: #eff7ee;
  border-color: #9bbd99;
}
.mailNotice {
  background: #fff0d4;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}
select {
  font: inherit;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 100%;
}
@media (max-width: 700px) {
  .bubble.outcome {
    font-size: 16px;
    padding: 17px;
  }
  .orderCard {
    padding: 16px;
  }
}

/* Keep publishing beside the result, above optional contact and letter details. */
.orderPrompt h3 {
  margin: 0 0 7px;
}
.orderPrompt p {
  margin: 7px 0;
}
.orderExplanation,
#contactSummary {
  font-size: 14px;
}
.orderSubmitRow {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 12px 0;
}
.orderSubmitRow button {
  flex: none;
}
.orderSubmitRow small {
  line-height: 1.4;
}
@media (max-width: 700px) {
  .orderSubmitRow {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
}

#adminPanel {
  width: min(1100px, 96vw);
  max-height: 92dvh;
}
.adminToolbar,
.adminTabs,
.adminFilters,
.setupNotice {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}
.adminTabs {
  justify-content: flex-start;
  margin: 20px 0 12px;
  flex-wrap: wrap;
}
.adminToolbar p {
  margin: 0;
}
.metricGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.metric {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f6f8f2;
  padding: 16px;
}
.metric strong {
  display: block;
  font-size: 32px;
  line-height: 1.3;
  margin: 5px 0;
}
.metric small {
  font-size: 13px;
  color: var(--ink);
}
.metric span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.adminFilters label:first-child {
  flex: 1;
}
.adminUser {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.adminUser h3 {
  margin: 0;
  font-size: 17px;
}
.adminUser p {
  margin: 5px 0;
}
.adminUser button {
  flex: none;
}
.adminUser details {
  margin-top: 8px;
}
.operationsGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.operationsGrid .result {
  margin: 0;
}
.setupNotice {
  padding: 16px;
  background: #fff6dc;
  border-radius: 10px;
  margin-top: 14px;
}
.setupNotice p {
  font-size: 13px;
  margin: 5px 0 0;
}
.setupNotice button {
  flex: none;
}
#accountSetupForm label span {
  display: block;
  font-size: 12px;
  font-weight: 400;
}
#companySearch {
  display: flex;
  align-items: end;
  gap: 10px;
}
#companySearch label {
  flex: 1;
}
#companySearch button {
  margin-bottom: 10px;
}
@media (max-width: 700px) {
  .metricGrid {
    grid-template-columns: 1fr 1fr;
  }
  .metric {
    padding: 12px;
  }
  .metric strong {
    font-size: 25px;
  }
  .operationsGrid {
    grid-template-columns: 1fr;
  }
  .setupNotice {
    flex-direction: column;
    align-items: stretch;
  }
  .adminFilters {
    align-items: stretch;
    flex-direction: column;
    gap: 0;
  }
  .adminUser {
    flex-direction: column;
    gap: 10px;
  }
}

#profilePanel {
  width: min(800px, calc(100vw - 32px));
}
#companyForm {
  display: grid;
  gap: 16px;
}
#companyForm label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}
#companyForm textarea,
#companyForm input {
  width: 100%;
  box-sizing: border-box;
  font-weight: 400;
}
#companyForm textarea {
  resize: vertical;
}
.companyGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.companyStatus {
  display: grid;
  gap: 5px;
  border-radius: 12px;
  padding: 16px;
  background: #eaf1ff;
  color: #203f72;
  margin: 14px 0;
}
.companyStatus strong {
  font-size: 19px;
}
.companyStatus.indexed {
  background: #e4f4ec;
  color: #155b3f;
}
.companyStatus.failed {
  background: #fff1e6;
  color: #854113;
}
.prefillNote {
  border-left: 3px solid #7ba995;
  padding-left: 12px;
  font-size: 14px;
}
.companyActions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  position: sticky;
  bottom: -1px;
  background: white;
  padding: 14px 0 4px;
}
#companySaved {
  color: #176540;
  font-size: 14px;
}
@media (max-width: 600px) {
  .companyGrid {
    grid-template-columns: 1fr;
  }
}
.supplierContactAction {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.supplierContactAction small {
  color: var(--muted);
}
.companyThread {
  border-left: 4px solid var(--green);
}
.companyThread .reply {
  white-space: pre-wrap;
}
#companyContactPanel {
  width: min(720px, calc(100vw - 32px));
}
#companyContactData pre {
  white-space: pre-wrap;
}
.contactRoute {
  background: #edf4ef;
  border-radius: 12px;
  padding: 14px;
}
#companyContactError {
  color: #9b342c;
}

/* Compact task rail and distinct, named conversation destinations. */
aside {
  background: #f0f3ed;
}
.asideHead {
  gap: 8px;
}
.asideHead button {
  padding: 8px 10px;
  white-space: nowrap;
}
.task {
  --task-bg: #f8f9f5;
  --task-accent: #5a6a60;
  background: var(--task-bg);
  border: 1px solid transparent;
  border-left: 4px solid var(--task-accent);
  padding: 12px;
  border-radius: 10px;
  margin: 10px 0;
  transition: box-shadow 120ms;
}
.task-need {
  --task-bg: #e8f0fb;
  --task-accent: #315c93;
}
.task-offer {
  --task-bg: #e6f2e8;
  --task-accent: #2c6845;
}
.task-inquiry {
  --task-bg: #f1eafb;
  --task-accent: #7854a0;
}
.task.active {
  background: var(--task-bg);
  border-color: var(--task-accent);
  box-shadow:
    inset 0 0 0 1px var(--task-accent),
    0 2px 6px #203c3210;
}
.task:hover {
  box-shadow: 0 2px 8px #203c3226;
}
.taskKind {
  display: block;
  color: var(--task-accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
.taskTitle {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 7px;
}
.task small {
  color: #57675e;
  font-size: 11px;
}
.task .badge {
  background: var(--task-accent);
}
#timeline > div,
#timeline > p {
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}
.chatHeading > div:first-child {
  min-width: 0;
}
.chatHeading h2 {
  max-width: min(860px, 60vw);
}
.partnerTone {
  --partner-bg: #eef5fc;
  --partner-border: #aac5e6;
  --partner-accent: #315d8d;
}
.tone1 {
  --partner-bg: #f4effa;
  --partner-border: #cfbce4;
  --partner-accent: #775398;
}
.tone2 {
  --partner-bg: #edf6f2;
  --partner-border: #a9cdbf;
  --partner-accent: #326c59;
}
.tone3 {
  --partner-bg: #fcf3e8;
  --partner-border: #e4c49e;
  --partner-accent: #875e2f;
}
.tone4 {
  --partner-bg: #fbeef2;
  --partner-border: #e5b9c9;
  --partner-accent: #914e69;
}
.tone5 {
  --partner-bg: #ecf5f7;
  --partner-border: #a9cdd8;
  --partner-accent: #316b7c;
}
.result.partnerTone {
  background: var(--partner-bg);
  border-color: var(--partner-border);
  border-left: 4px solid var(--partner-accent);
  padding: 18px 20px;
  margin: 16px 0;
}
.partnerIdentity {
  color: var(--partner-accent);
  font-size: 17px;
}
.result.partnerTone > small {
  color: var(--partner-accent);
  font-weight: 650;
  font-size: 11px;
  letter-spacing: 0.5px;
}
.result.partnerTone > button {
  border-color: var(--partner-border);
  color: var(--partner-accent);
  font-weight: 650;
}
.reply {
  background: #ffffffb8;
  border: 1px solid var(--partner-border, var(--line));
  white-space: pre-wrap;
}
.reply.ownReply {
  margin-left: 28px;
  background: #ffffff70;
}
.reply small {
  color: var(--partner-accent, var(--muted));
  font-weight: 650;
}
#conversation.partnerTone .bubble.assistant {
  background: var(--partner-bg);
  border-left: 3px solid var(--partner-accent);
}
#compose {
  padding-top: 10px;
}
#compose > * {
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}
.composeHeading {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
#compose label {
  font-weight: 700;
  margin: 0;
}
#composeHelp {
  margin-top: 4px;
  margin-bottom: 10px;
  color: #56675e;
}
#sendMessage {
  white-space: nowrap;
  font-size: 13px;
}
@media (max-width: 700px) {
  main {
    grid-template-columns: none;
  }
  aside {
    padding: 6px 12px;
    max-height: 170px;
  }
  #tasks {
    max-height: 106px;
  }
  .task {
    margin: 4px 0;
    padding: 7px 9px;
  }
  .taskKind {
    margin-bottom: 3px;
    font-size: 11px;
  }
  .taskTitle {
    -webkit-line-clamp: 2;
    font-size: 12px;
    margin-bottom: 3px;
  }
  .chatHeading h2 {
    max-width: 45vw;
  }
  .result.partnerTone {
    padding: 14px;
  }
  #compose label {
    font-size: 12px;
  }
  #composeHelp {
    font-size: 11px;
    margin-bottom: 7px;
  }
  #sendMessage {
    white-space: normal;
    max-width: 88px;
    font-size: 12px;
  }
}

/* Partner messages use a simple input dialog; the task keeps the conversation. */
.mobileTaskBar {
  display: none;
}
#partnerPanel {
  width: min(600px, calc(100vw - 32px));
  max-height: min(640px, calc(100dvh - 48px));
  padding: 0;
  overflow: hidden;
}
#partnerPanel[open] {
  display: flex;
  flex-direction: column;
}
.messageDialogHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.messageDialogHead > div {
  min-width: 0;
}
.messageDialogHead h2 {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  font-size: 20px;
}
.messageDialogHead small {
  color: var(--muted);
}
#closePartner,
#closeCompanyContact {
  min-width: 44px;
  min-height: 44px;
  flex: none;
  font-size: 22px;
  padding: 4px;
}
#partnerForm {
  padding: 0 22px 18px;
  overflow-y: auto;
  min-height: 0;
  overscroll-behavior: contain;
}
#partnerBody {
  min-height: 140px;
  max-height: 240px;
  resize: vertical;
  font-size: 16px;
}
#partnerError,
#partnerUnavailable {
  color: #973a2b;
}
#partnerStatus {
  color: #236143;
}
#partnerError:empty,
#partnerStatus:empty {
  display: none;
}
.messageDialogActions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: white;
  padding: 12px 0 4px;
  position: sticky;
  bottom: 0;
}
.messageDialogActions button {
  min-height: 44px;
  min-width: 105px;
}
.desktopMessageHint {
  display: block;
  text-align: right;
  margin-top: 6px;
}
#companyContactPanel {
  max-height: calc(100dvh - 40px);
  overflow: hidden;
  padding: 0;
}
#companyContactPanel[open] {
  display: flex;
  flex-direction: column;
}
#companyContactPanel > .asideHead {
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
#companyContactPanel h2 {
  overflow-wrap: anywhere;
  margin: 0;
}
#companyContactData {
  padding: 0 22px 20px;
  overflow-y: auto;
  min-height: 0;
  overscroll-behavior: contain;
}
#companyContactForm textarea {
  font-weight: 400;
}
#companyContactForm > button {
  position: sticky;
  bottom: 0;
  min-height: 44px;
  box-shadow: 0 0 0 8px white;
}
@media (max-width: 700px) {
  body {
    height: var(--visible-height, 100dvh);
  }
  header {
    display: grid;
    grid-template-columns: 1fr auto auto;
    padding-top: max(8px, env(safe-area-inset-top));
  }
  header small {
    grid-column: 1 / -1;
    grid-row: 2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  header button {
    min-height: 44px;
  }
  header b {
    font-size: 19px;
  }
  .mobileTaskBar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex: none;
    padding: 5px 12px;
    border-bottom: 1px solid var(--line);
  }
  .mobileTaskBar button {
    min-height: 44px;
    padding: 7px 12px;
  }
  #taskSidebar {
    display: none;
  }
  .tasksOpen #taskSidebar {
    display: block;
    max-height: 136px;
    padding: 4px 12px;
  }
  #taskSidebar .asideHead {
    display: none;
  }
  #tasks {
    max-height: 124px;
    padding-bottom: 4px;
  }
  .task {
    flex: 0 0 200px;
  }
  .chatHeading {
    align-items: center;
  }
  .chatHeading h2 {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .chatHeading button {
    min-height: 44px;
  }
  .chatHeading > div:first-child {
    flex: 1;
  }
  #compose {
    padding: 9px 12px max(10px, env(safe-area-inset-bottom));
  }
  #input {
    font-size: 16px;
  }
  #sendMessage {
    min-height: 48px;
  }
  .inputHint,
  .desktopMessageHint {
    display: none;
  }
  .result button,
  .result summary {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .result summary {
    padding: 6px 0;
  }
  #partnerPanel,
  #companyContactPanel {
    position: fixed;
    width: 100%;
    max-width: 100%;
    max-height: calc(var(--visible-height, 100dvh) - 12px);
    margin: 0;
    inset: auto 0 auto 0;
    top: calc(var(--visible-top, 0px) + var(--visible-height, 100dvh));
    transform: translateY(-100%);
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
  }
  .messageDialogHead,
  #companyContactPanel > .asideHead {
    padding: 12px 16px;
    gap: 10px;
  }
  .messageDialogHead h2 {
    font-size: 18px;
  }
  #partnerForm,
  #companyContactData {
    padding: 0 16px max(12px, env(safe-area-inset-bottom));
  }
  #partnerForm > .muted {
    font-size: 13px;
  }
  #partnerBody {
    min-height: 120px;
    max-height: 180px;
    resize: none;
  }
  #companyContactForm textarea {
    min-height: 120px;
    max-height: 180px;
  }
  dialog input,
  dialog textarea,
  dialog select {
    font-size: 16px;
  }
  .messageDialogActions button {
    flex: 1;
    min-height: 48px;
  }
  #companyContactForm > button {
    width: 100%;
    min-height: 48px;
  }
}
@media (max-width: 700px) and (max-height: 550px) {
  #partnerForm > .muted {
    display: none;
  }
  #partnerBody {
    min-height: 90px;
    height: 100px;
  }
  .messageDialogHead {
    padding-top: 8px;
    padding-bottom: 8px;
  }
}

.invitationPanel {
  border: 2px solid #2b6955;
  background: #edf7f0;
  margin: 24px auto;
  max-width: 640px;
  overflow-wrap: anywhere;
}
.invitationPanel + #loginPanel {
  margin-top: 24px;
}

.invitationPanel {
  padding: 24px;
  margin-bottom: 16px;
}
.invitationPanel h1 {
  font-size: clamp(23px, 4vw, 30px);
  line-height: 1.25;
  margin: 12px 0;
}
.invitationAuth > h1,
.invitationAuth > p,
.invitationAuth label:has(#name),
.invitationAuth label:has(#phone) {
  display: none;
}
@media (max-width: 700px) {
  .invitationAuth {
    padding: 20px;
  }
  .invitationPanel {
    padding: 20px;
  }
}
