:root {
  color-scheme: light;
  --wine: #7e0416;
  --wine-hover: #610311;
  --ink: #171412;
  --paper: #ffffff;
  --background: #f5f2ed;
  --field: #eee9e2;
  --rose: #f3e4e5;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  accent-color: var(--wine);
  font-family: var(--font);
  color: var(--ink);
  background: var(--background);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  font-size: 16px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button,
.button {
  min-height: 48px;
  padding: 11px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--paper);
  color: var(--wine);
  font-weight: 650;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  line-height: 1.35;
}

button:hover,
.button:hover {
  background: var(--rose);
}

button.primary,
.button.primary {
  background: var(--wine);
  color: white;
}

button.primary:hover,
.button.primary:hover {
  background: var(--wine-hover);
}

button:disabled {
  opacity: 0.38;
  cursor: default;
}

:focus-visible {
  outline: 3px solid var(--wine);
  outline-offset: 4px;
}

h1:focus,
h2:focus {
  outline: none;
}

a {
  color: var(--wine);
  text-underline-offset: 4px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.035em;
  font-weight: 730;
}

h2 {
  font-size: 23px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

h3 {
  font-size: 17px;
  line-height: 1.4;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.preview {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 8px 24px;
  background: #e7e0d7;
  font-size: 13px;
}

.preview-options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.preview button {
  min-height: 44px;
  padding: 8px 12px;
  font-size: 13px;
  background: transparent;
  color: var(--ink);
}

.preview button[aria-pressed="true"] {
  background: var(--ink);
  color: white;
}

.app-header {
  background: var(--paper);
}

.header-inner {
  max-width: 1280px;
  min-height: 88px;
  margin: auto;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  gap: 58px;
}

.brand {
  font-size: 24px;
  letter-spacing: -1.1px;
  font-weight: 850;
  white-space: nowrap;
}

.brand span {
  color: var(--wine);
}

#navigation {
  display: flex;
  gap: 8px;
}

#navigation button {
  padding-inline: 24px;
  color: var(--ink);
}

#navigation button[aria-current="page"] {
  background: var(--wine);
  color: white;
}

#app {
  max-width: 1280px;
  margin: auto;
  padding: 38px 28px 72px;
}

.page-heading,
.panel-heading,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.page-heading {
  margin-bottom: 28px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.state-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px;
  margin: -4px -4px 20px;
}

.state-filters button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.state-filters button[aria-pressed="true"] {
  background: var(--wine);
  color: white;
}

label,
.field {
  display: grid;
  gap: 8px;
  font-weight: 600;
  min-width: 0;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  border: 0;
  border-radius: 9px;
  background: var(--field);
  padding: 12px 14px;
  font-weight: 400;
}

select {
  padding-right: 32px;
}

textarea {
  resize: vertical;
  min-height: 112px;
  line-height: 1.5;
}

input[type="file"] {
  padding: 8px;
  font-size: 14px;
}

input[type="file"]::file-selector-button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 7px 12px;
  margin-right: 10px;
  background: white;
  color: var(--wine);
  font: inherit;
  cursor: pointer;
}

input[type="checkbox"] {
  width: 24px;
  height: 24px;
  min-height: 24px;
  margin: 0;
  padding: 0;
}

.mail-row {
  width: 100%;
  justify-content: space-between;
  text-align: left;
  background: var(--rose);
  padding: 18px 22px;
  margin-bottom: 24px;
  gap: 16px;
}

.mail-row span:last-child {
  font-size: 15px;
  white-space: nowrap;
}

.client-head,
.client-row {
  display: grid;
  grid-template-columns:
    minmax(150px, 1.15fr)
    64px
    minmax(220px, 1.8fr)
    minmax(135px, 0.8fr);
  column-gap: 24px;
  align-items: center;
}

.client-head {
  padding: 0 22px 12px;
  font-size: 14px;
  font-weight: 650;
}

.client-list,
.route-options,
.route-stops,
.messages {
  list-style: none;
  margin: 0;
  padding: 0;
}

.client-list {
  display: grid;
  gap: 8px;
}

.client-row {
  width: 100%;
  text-align: left;
  padding: 22px;
  color: var(--ink);
  font-weight: 400;
  background: var(--paper);
  border-radius: 12px;
}

.client-row:hover {
  background: #eee5dc;
}

.client-name {
  font-size: 18px;
  font-weight: 700;
}

.country {
  font-weight: 700;
}

.client-garage {
  line-height: 1.5;
}

.state {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 7px;
  width: fit-content;
  max-width: 100%;
  background: var(--field);
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.4;
}

.state.quote,
.state.agent {
  color: var(--wine);
  background: var(--rose);
}

.empty,
.feedback {
  padding: 16px 20px;
  border-radius: 10px;
  background: var(--paper);
}

.feedback {
  margin-top: 16px;
}

.back {
  margin-bottom: 22px;
  padding-left: 0;
  padding-right: 14px;
  background: transparent;
}

.customer-details {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr);
  gap: 40px;
  padding: 28px;
  background: var(--paper);
  border-radius: 14px;
  margin-bottom: 28px;
}

.contact-data,
.request-data {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
}

.contact-data a,
.request-data a,
.message a {
  overflow-wrap: anywhere;
}

.contact-data a {
  width: fit-content;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.request-data > .button {
  justify-self: start;
}

.request-data h2 {
  font-size: 19px;
}

.text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.conversations {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 28px;
}

.conversation {
  min-width: 0;
  padding: 28px;
  border-radius: 14px;
  background: var(--paper);
}

.conversation h2 {
  margin-bottom: 26px;
}

.messages {
  display: grid;
  gap: 28px;
  margin-bottom: 28px;
}

.message {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.message strong {
  font-size: 14px;
}

.message .price {
  font-size: 25px;
  font-weight: 730;
  letter-spacing: -0.025em;
}

.message a {
  width: fit-content;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.form-stack {
  display: grid;
  gap: 18px;
}

.form-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-stack > button {
  justify-self: start;
}

dialog {
  width: min(680px, calc(100% - 32px));
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 28px;
  overflow: auto;
  border: 0;
  border-radius: 16px;
  color: var(--ink);
  background: var(--paper);
}

dialog::backdrop {
  background: rgb(23 20 18 / 42%);
}

.panel-heading {
  margin-bottom: 24px;
  align-items: start;
}

.panel-heading h2 {
  padding-top: 8px;
}

.panel-heading button {
  padding-inline: 12px;
}

.methods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 26px;
}

.methods button {
  background: var(--field);
  color: var(--ink);
  flex: 1 1 145px;
}

.methods button[aria-pressed="true"] {
  background: var(--wine);
  color: white;
}

.mail-content {
  display: grid;
  gap: 14px;
  margin-bottom: 26px;
}

.comparison {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0 7px;
  font-variant-numeric: tabular-nums;
}

.comparison caption {
  text-align: left;
  padding: 0 0 18px;
  font-weight: 600;
}

.comparison th,
.comparison td {
  padding: 13px 10px;
  vertical-align: middle;
}

.comparison th:first-child {
  width: 46%;
  text-align: left;
}

.comparison thead th {
  font-size: 16px;
}

.comparison tbody th {
  font-weight: 500;
}

.comparison td {
  text-align: center;
  font-weight: 650;
}

.comparison tbody tr:nth-child(odd) > * {
  background: var(--background);
}

.comparison tbody th {
  border-radius: 8px 0 0 8px;
}

.comparison tbody td:last-child {
  border-radius: 0 8px 8px 0;
}

.route-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(340px, 1fr);
  gap: 28px;
  align-items: start;
}

.route-map-column,
.route-plan {
  min-width: 0;
}

#map {
  width: 100%;
  height: 480px;
  background: #e6e2d8;
  border-radius: 14px;
  overflow: hidden;
  isolation: isolate;
}

.route-map-column h2 {
  margin: 28px 0 16px;
}

.route-options {
  display: grid;
  gap: 8px;
}

.route-option {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  background: white;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.route-option .route-person a {
  justify-self: start;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.check-target {
  width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.route-person {
  display: grid;
  justify-content: start;
  text-align: left;
  gap: 3px;
  padding: 8px;
  color: var(--ink);
  background: transparent;
}

.route-person span {
  font-weight: 400;
}

.route-plan h2 {
  margin-bottom: 20px;
}

.route-origin {
  padding: 16px 18px;
  background: var(--ink);
  color: white;
  border-radius: 10px;
  font-weight: 650;
  margin-bottom: 12px;
}

.route-stops {
  display: grid;
  gap: 12px;
}

.route-stop {
  background: white;
  border-radius: 12px;
  padding: 18px;
  min-width: 0;
}

.route-stop .route-person {
  padding: 0;
  min-height: 44px;
}

.route-stop p {
  margin-top: 12px;
}

.route-stop .actions {
  margin-top: 14px;
  gap: 8px;
}

.route-stop .actions button {
  background: var(--background);
  padding-inline: 12px;
  flex: 1 1 auto;
}

.route-total {
  margin: 24px 0 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 20px;
  font-weight: 730;
}

.route-plan > .actions > * {
  flex: 1 1 auto;
}

.leaflet-container {
  font-family: var(--font);
}

.leaflet-container .leaflet-control-zoom a {
  width: 44px;
  height: 44px;
  line-height: 44px;
  color: var(--ink);
  border: 0;
}

.leaflet-control-zoom {
  border: 0 !important;
  box-shadow: none !important;
}

.leaflet-control-attribution {
  font-size: 10px !important;
}

.map-marker {
  background: transparent;
  border: 0;
}

.map-pin {
  width: 32px;
  height: 32px;
  margin: 2px 6px;
  display: grid;
  place-items: center;
  background: var(--wine);
  color: white;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
}

.map-pin span {
  transform: rotate(45deg);
  font-size: 14px;
  font-weight: 750;
}

.map-pin:not(.selected) span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
}

.map-base {
  background: var(--ink);
}

@media (max-width: 1000px) {
  .client-head,
  .client-row {
    grid-template-columns:
      minmax(130px, 1fr)
      42px
      minmax(180px, 1.3fr)
      130px;
    column-gap: 16px;
  }

  .route-layout {
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr);
    gap: 20px;
  }

  .conversation {
    padding: 22px;
  }
}

@media (max-width: 760px) {
  .preview {
    padding: 6px 12px;
    gap: 4px;
    min-height: 56px;
  }

  .preview button {
    padding-inline: 9px;
    font-size: 12px;
  }

  .header-inner {
    min-height: 78px;
    padding: 14px 16px;
    gap: 16px;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .brand {
    font-size: 21px;
  }

  #navigation {
    gap: 4px;
  }

  #navigation button {
    padding-inline: 13px;
  }

  #app {
    padding: 26px 16px 48px;
  }

  .page-heading {
    gap: 20px;
    margin-bottom: 22px;
  }

  .page-heading > .actions {
    width: 100%;
  }

  .page-heading > .actions > * {
    flex: 1 1 auto;
  }

  .mail-row {
    padding: 16px;
    font-size: 15px;
    gap: 10px;
  }

  .mail-row span:last-child {
    font-size: 14px;
  }

  .client-head {
    display: none;
  }

  .client-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 16px;
    padding: 18px;
  }

  .client-name {
    font-size: 18px;
  }

  .country {
    justify-self: end;
  }

  .client-garage,
  .client-info {
    grid-column: 1 / -1;
  }

  .customer-details,
  .conversations,
  .route-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .customer-details {
    gap: 26px;
    padding: 22px;
    margin-bottom: 20px;
  }

  .conversations {
    gap: 20px;
  }

  .conversation {
    padding: 22px;
  }

  .conversation h2 {
    margin-bottom: 22px;
  }

  .form-stack > button {
    width: 100%;
  }

  dialog {
    width: calc(100% - 24px);
    max-height: calc(100dvh - 24px);
    padding: 20px;
    border-radius: 14px;
  }

  .panel-heading {
    gap: 10px;
  }

  .panel-heading h2 {
    max-width: calc(100% - 90px);
  }

  .methods {
    gap: 6px;
  }

  .methods button {
    flex-basis: 100%;
  }

  .comparison {
    font-size: 13px;
  }

  .comparison th,
  .comparison td {
    padding: 12px 5px;
    overflow-wrap: anywhere;
  }

  .comparison th:first-child {
    width: 44%;
  }

  .comparison thead th {
    font-size: 14px;
  }

  .route-layout {
    gap: 30px;
  }

  #map {
    height: 340px;
  }

  .route-stop {
    padding: 18px;
  }
}

@media (max-width: 370px) {
  .header-inner {
    gap: 8px;
  }

  .brand {
    font-size: 19px;
  }

  #navigation button {
    padding-inline: 10px;
  }

  .form-two {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}

/* Karta klienta: kontakt z podpisami i wycena u góry (Adrian 30.10) */
.facts {
  display: grid;
  gap: 6px;
  margin: 0;
}

.facts > div {
  display: grid;
  grid-template-columns: 7.5em minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 6px 14px;
  background: var(--background);
  border-radius: 10px;
}

.facts dt {
  font-weight: 650;
}

.facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.facts a {
  min-height: 0;
}

.quote-price {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0;
  padding: 14px 16px;
  background: var(--rose);
  border-radius: 10px;
  font-size: 26px;
  font-weight: 750;
  color: var(--wine);
}

.quote-price span {
  font-size: 16px;
  font-weight: 650;
  color: var(--ink);
}

@media (max-width: 420px) {
  .facts > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    padding: 10px 14px;
  }
}

/* Drugi przycisk: biały z bordową ramką, żeby na białym tle było widać, że to przycisk (Adrian 30.10) */
.button:not(.primary),
button[type="submit"]:not([class]),
button[class=""]:not([data-action="navigate"]):not([data-action="move"]):not([data-action="method"]) {
  box-shadow: inset 0 0 0 2px var(--wine);
}

/* Mapa Google w makiecie trasy (Adrian 30.10) */
#map iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.route-back {
  margin: 16px 0 0;
  padding: 14px 16px;
  background: var(--paper);
  border-radius: 12px;
}

/* Kontakt i Zapytanie jako dwa osobne okienka, wycena jako wiersz (Adrian 30.10) */
.customer-details {
  padding: 0;
  gap: 20px;
  background: transparent;
  align-items: start;
}

.contact-data,
.request-data {
  gap: 16px;
  padding: 28px;
  background: var(--paper);
  border-radius: 14px;
}

.fact-price dd {
  font-size: 22px;
  font-weight: 750;
  color: var(--wine);
}

@media (max-width: 760px) {
  .customer-details {
    padding: 0;
    gap: 16px;
  }

  .contact-data,
  .request-data {
    padding: 22px;
  }
}

.customer-details {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.customer-details h2 {
  font-size: 22px;
}

.facts > div {
  grid-template-columns: 6.5em minmax(0, 1fr);
}

.facts a[href^="tel:"] {
  white-space: nowrap;
}

@media (max-width: 760px) {
  .customer-details {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 420px) {
  .facts > div {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Okienka obok siebie równej wysokości, pole wiadomości zawsze na dole (Adrian 30.10) */
.conversations,
.customer-details {
  align-items: stretch;
}

.conversation {
  display: flex;
  flex-direction: column;
}

.conversation > form {
  margin-top: auto;
}

/* Wiadomości: kto i kiedy; cena z walutą kraju (Adrian 30.10) */
.message-head {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  margin: 0;
}

.message-head span {
  font-size: 14px;
}

.price-input {
  display: flex;
  align-items: center;
  gap: 12px;
}

.price-input input {
  flex: 1;
  min-width: 0;
  font-size: 22px;
  font-weight: 700;
}

.price-input span {
  font-size: 18px;
  font-weight: 700;
}

/* Na telefonie nie ma nagłówka kolumn, więc podpis „Wpłynęło” stoi przy dacie (Adrian 30.10) */
@media (max-width: 760px) {
  .client-info[data-label]:not([data-label=""])::before {
    content: attr(data-label) " ";
  }
}

/* Jedna oś rozmowy i pole pisania. */
.conversation-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  align-items: start;
  gap: 24px;
}

.thread {
  min-width: 0;
}

.thread > h2 {
  margin: 0 0 16px;
}

.thread-window {
  height: clamp(360px, 65vh, 720px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 12px 16px;
  border-radius: 14px;
  scrollbar-gutter: stable;
  overscroll-behavior-y: contain;
}

.thread-window:focus-visible {
  outline-offset: -3px;
}

.thread-list {
  display: grid;
  align-content: start;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.thread-day {
  justify-self: center;
  margin-top: 8px;
  color: #5b514d;
  font-size: 14px;
  font-weight: 650;
}

.thread-day span {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  background: #e7e0d7;
}

.thread-event {
  justify-self: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 4px 10px;
  max-width: 94%;
  color: #5b514d;
  font-size: 14px;
  text-align: center;
  overflow-wrap: anywhere;
}

.thread-event time,
.thread-meta time {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.thread-message {
  display: grid;
  justify-self: start;
  justify-items: start;
  gap: 8px;
  min-width: 0;
  max-width: 88%;
}

.thread-bubble {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 16px 18px;
  border-radius: 16px 16px 16px 4px;
  background: var(--paper);
  overflow-wrap: anywhere;
}

.thread-team .thread-bubble {
  background: var(--rose);
}

.thread-own {
  justify-self: end;
  justify-items: end;
}

.thread-own .thread-bubble {
  background: var(--wine-hover);
  color: white;
  border-radius: 16px 16px 4px 16px;
}

.thread-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
  font-size: 14px;
}

.thread-meta time {
  margin-left: 6px;
}

.thread-subject {
  font-size: 16px;
}

.thread-price {
  font-size: clamp(23px, 2.3vw, 30px);
  font-weight: 750;
  line-height: 1.25;
}

.thread-bubble a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.thread-own a {
  color: white;
}

.thread-own :focus-visible {
  outline-color: white;
}

button.secondary {
  background: var(--paper);
  color: var(--wine);
  box-shadow: inset 0 0 0 2px var(--wine);
}

button.secondary:hover {
  background: var(--rose);
}

.thread-reply {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 14px;
}

.thread-reply[aria-pressed="true"] {
  background: var(--rose);
}

.composer {
  position: sticky;
  top: 20px;
  display: grid;
  align-content: start;
  gap: 20px;
  min-width: 0;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 24px;
  background: var(--paper);
  border-radius: 14px;
}

.composer h2 {
  font-size: 22px;
}

.composer-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.composer-channels button {
  flex: 1 1 120px;
  padding-inline: 12px;
}

.composer textarea {
  min-height: 180px;
}

.composer .form-stack > button {
  width: 100%;
}

.reply-context {
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: var(--rose);
  font-size: 14px;
}

.reply-context button {
  min-height: 44px;
  padding: 8px 12px;
}

@media (max-width: 1000px) {
  .conversation-layout {
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 18px;
  }

  .composer {
    padding: 20px;
  }
}

@media (max-width: 760px) {
  .conversation-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .thread-window {
    height: clamp(300px, 60svh, 560px);
    padding: 6px 4px 14px;
    overscroll-behavior-y: auto;
  }

  .thread-message {
    max-width: 94%;
  }

  .thread-bubble {
    padding: 14px;
  }

  .thread-meta,
  .thread-event,
  .thread-day,
  .thread-reply,
  .reply-context {
    font-size: 15px;
  }

  .composer {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 20px;
  }

  .composer textarea {
    min-height: 140px;
  }
}

/* Rozmowa i pole pisania w jednym dużym okienku, w środku dwa wydzielone bloki (Adrian 30.10) */
.conversation-layout {
  padding: 24px;
  background: var(--paper);
  border-radius: 14px;
  align-items: stretch;
}

.thread-window {
  background: var(--background);
}

.composer {
  background: var(--background);
}

@media (max-width: 760px) {
  .conversation-layout {
    padding: 16px;
  }
}

.composer input,
.composer textarea,
.composer select {
  background: var(--paper);
}

/* Nagłówki „Rozmowa” i pola pisania w jednym rzędzie na białym, beżowe bloki pod nimi równej wysokości (Adrian 30.10) */
.conversation-layout {
  grid-template-rows: auto 1fr;
  row-gap: 16px;
}

.thread,
.composer {
  display: contents;
}

.thread > h2,
.composer > h2 {
  grid-row: 1;
  margin: 0;
}

.thread-window {
  grid-row: 2;
  grid-column: 1;
}

.composer-box {
  grid-row: 2;
  grid-column: 2;
  display: grid;
  align-content: start;
  gap: 20px;
  min-width: 0;
  padding: 24px;
  background: var(--background);
  border-radius: 14px;
}

@media (max-width: 760px) {
  .conversation-layout {
    grid-template-rows: none;
  }

  .thread > h2,
  .thread-window,
  .composer > h2,
  .composer-box {
    grid-row: auto;
    grid-column: 1;
  }
}

/* Pola tekstowe o stałej wysokości, bez rozciągania; przy dłuższej treści suwak (Adrian 30.10) */
textarea {
  resize: none;
  overflow-y: auto;
}

/* Pole pisania wypełnia blok do dołu, przycisk wysyłki zawsze na dole (Adrian 30.10) */
.composer-box {
  display: flex;
  flex-direction: column;
}

.composer-box > form {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.composer-box > form > label:has(textarea) {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.composer-box textarea {
  flex: 1;
  min-height: 140px;
}

/* „Ułóż trasę automatycznie” z odstępem nad listą punktów, bez kafelka „Rupniów” (Adrian 30.10) */
[data-action="auto-route"] {
  width: 100%;
  margin-bottom: 20px;
}

.thread-files {
  display: flex;
  flex-wrap: wrap;
  column-gap: 16px;
}

/* Program (poza makietą): logowanie, wylogowanie, zamówienie bez położenia na mapie. */
.logout {
  margin-left: auto;
  color: var(--ink);
}

.login {
  max-width: 420px;
  margin: 40px auto 0;
  padding: 32px;
  border-radius: 16px;
  background: var(--paper);
}

.login h1 {
  margin-top: 0;
}

.login .remember {
  display: flex;
  align-items: center;
  gap: 10px;
}

.login .remember input {
  width: 22px;
  height: 22px;
}

.route-unknown {
  color: var(--wine);
}
