/* Mes demandes and Messages, and the conversation they share, in the new look (SKI-1283;
   portalRequestsMessages/requestsWide, inboxWide, threadWide, inboxPhone, threadPhone). Every
   value reads a variable of css/tokens.css; nothing moves but the shake of an empty send
   (portal.css). The chips, the pills, the buttons, the fields and the in-list empty are
   css/controls.css's: placed here, never redrawn. */

/* ── Mes demandes: the head's chips (the toolbar, css/controls.css), then one paper card per
   request, 24 apart ── */
#tickets {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.ticket {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
}
/* An answer not seen yet: a bar of rose's deep inside the card's left edge, until it is opened
   (portal.js takes .has-new off). */
.ticket.has-new {
  box-shadow: inset 3px 0 0 var(--color-rose-deep);
}
/* The picture on oat, the name a Name and its details a Small in muted, the state pill, the
   number a Small in muted. */
.thead {
  display: flex;
  align-items: center;
  gap: 14px;
}
.thead img,
.thead .noimg {
  flex: none;
  width: var(--size-tile-large);
  height: var(--size-tile-large);
  border: 0;
  border-radius: var(--radius-16);
  background: var(--color-oat);
  object-fit: contain;
}
.thead .noimg .ph {
  width: 20px;
  height: 20px;
}
.thead > div {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.thead b {
  color: var(--color-ink);
  font-size: var(--text-name);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-name);
}
.thead > div > div {
  color: var(--color-muted);
  font-size: var(--text-small);
  line-height: var(--leading-small);
}
.thead .ref {
  flex: none;
  color: var(--color-muted);
  font-size: var(--text-small);
  line-height: var(--leading-small);
}

/* The timeline: one dot of 10 per step in its state's look, a thin line down to the next; the
   step a Label in ink, its time and line a Small in muted. Done is green, waits for the shop
   butter, SkinSouk on it sky, not added oat with the unavailable ring; a step not reached yet is
   paper with the same ring and its words in muted. */
.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}
.timeline li {
  position: relative;
  padding: 0 0 14px 26px;
  color: var(--color-ink);
  font-size: var(--text-label);
  font-weight: var(--font-weight-medium);
  line-height: var(--leading-label);
}
.timeline li:last-child {
  padding-bottom: 0;
}
.timeline li::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 1px;
  box-sizing: border-box;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--color-unavailable);
  border-radius: var(--radius-pill);
  background: var(--color-paper);
}
.timeline li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 0;
  left: 5.5px;
  width: 1px;
  background: var(--color-edge-pill);
}
.timeline li.done::before {
  border: 0;
  background: var(--color-green-mid);
}
.timeline li.review::before {
  border: 0;
  background: var(--color-butter-mid);
}
.timeline li.info::before {
  border: 0;
  background: var(--color-sky-mid);
}
.timeline li.declined::before {
  background: var(--color-oat);
}
.timeline li:not(.done, .review, .info, .declined) {
  color: var(--color-muted);
}
.timeline time {
  display: block;
  max-width: 640px;
  margin-top: 2px;
  color: var(--color-muted);
  font-size: var(--text-small);
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-small);
}
.timeline a {
  color: var(--color-ink);
  text-decoration: underline 1px;
  text-underline-offset: 3px;
}

/* A request not added: the field and its quiet button, 44 high, side by side. */
.tfoot {
  display: flex;
}
.resend {
  display: flex;
  flex: 1;
  gap: 8px;
}
.resend .input {
  flex: 1;
  min-width: 0;
  height: var(--spacing-control);
}

/* The request's conversation, folded under its timeline: the line icon, a Label, the « Nouveau
   message » badge, the caret; open, the conversation on oat and the answer box. */
.conv {
  padding-top: 16px;
  border-top: 1px solid var(--color-edge);
}
.conv summary {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: var(--color-ink);
  font-size: var(--text-label);
  font-weight: var(--font-weight-medium);
  line-height: var(--leading-label);
  list-style: none;
  cursor: pointer;
}
.conv summary::-webkit-details-marker {
  display: none;
}
.conv summary .ph {
  width: 18px;
  height: 18px;
}
.conv summary .caret {
  width: 14px;
  height: 14px;
}
.conv[open] summary .caret {
  transform: rotate(180deg);
}
@media (hover: hover) {
  .conv summary:hover > span:first-of-type {
    text-decoration: underline 1px;
    text-underline-offset: 3px;
  }
}
.conv summary:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 2px;
  border-radius: var(--radius-pill);
}
/* « Nouveau message »: new to the shop, rose's tint and rose's deep, a badge as .chip.new. */
.newpill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--radius-pill);
  background: var(--color-rose-tint);
  color: var(--color-rose-deep);
  font-size: var(--text-badge);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-badge);
  white-space: nowrap;
}
.convbody {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 760px;
  padding-top: 20px;
}
.conv .conv-messages {
  padding: 16px;
  border-radius: var(--radius-16);
  background: var(--color-oat);
}

/* No request yet: a whole-page moment, no card. Ghayma at rest, 132, the Heading, its line in
   Body in ink 2. */
.tickets-none {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 24px;
  text-align: center;
}
.tickets-none img {
  flex: none;
  width: 132px;
  height: 132px;
  margin-bottom: 16px;
}
.tickets-none b {
  max-width: 520px;
  color: var(--color-ink);
  font-size: var(--text-heading);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-heading);
}
.tickets-none span {
  max-width: 520px;
  margin-top: 8px;
  color: var(--color-ink-2);
  font-size: var(--text-body);
  line-height: var(--leading-body);
}

/* ── the conversation (SKI-316): on oat, the shop at the right, SkinSouk at the left ── */
.conv-messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.conv-messages:empty {
  display: none;
}
.msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 78%;
}
.msg.ours {
  align-self: flex-end;
}
.msg.theirs {
  align-self: flex-start;
}
.msg > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.msg.ours > div {
  align-items: flex-end;
}
/* A message: a Body in ink, corners of 16; the shop's on rose's tint, SkinSouk's on paper with
   the thin edge. */
.bubble {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-16);
  color: var(--color-ink);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  overflow-wrap: anywhere;
}
.bubble p {
  white-space: pre-wrap;
}
.msg.ours .bubble {
  background: var(--color-rose-tint);
}
.msg.theirs .bubble {
  border: 1px solid var(--color-edge);
  background: var(--color-paper);
}
/* Who wrote it and when: a Small in muted under the bubble. */
.msg time {
  color: var(--color-muted);
  font-size: var(--text-small);
  line-height: var(--leading-small);
}
/* SkinSouk's face beside its answers: Nejma in a circle of rose's tint, 28, level with the
   bubble's foot (the caption's line and its gap of 6 under it). */
.msgavatar {
  flex: none;
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  margin-bottom: calc(var(--text-small) * 1.4 + 6px);
  padding: 1px;
  border-radius: var(--radius-pill);
  background: var(--color-rose-tint);
  object-fit: contain;
}
/* « Nouveau » above the first answer not seen: a Badge in rose's deep between two lines of rose's
   soft. */
.newline {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-rose-deep);
  font-size: var(--text-badge);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-badge);
}
.newline::before,
.newline::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-rose-soft);
}

/* What a message is about: a chip of paper inside the bubble (on oat in the answer box), its
   picture of 36 on oat, the name a Label, the details a Small in muted, and in the answer box its
   round « Retirer l'offre ». */
.listingchip {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 380px;
  padding: 8px 12px 8px 8px;
  border-radius: var(--radius-16);
  background: var(--color-paper);
}
.listingchip img,
.listingchip .noimg {
  flex: none;
  width: var(--size-tile-small);
  height: var(--size-tile-small);
  border: 0;
  border-radius: var(--radius-16);
  background: var(--color-oat);
  object-fit: contain;
}
.listingchip .noimg .ph {
  width: 18px;
  height: 18px;
}
.listingchip > div {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.listingchip b {
  color: var(--color-ink);
  font-size: var(--text-label);
  font-weight: var(--font-weight-medium);
  line-height: var(--leading-label);
}
.listingchip > div > span {
  color: var(--color-muted);
  font-size: var(--text-small);
  line-height: var(--leading-small);
}

/* The answer box: the field of several lines, then the note a Small in muted and « Envoyer », the
   main button where the shop acts. */
.composer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.attached {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.attached > span,
.composebar > span {
  color: var(--color-muted);
  font-size: var(--text-small);
  line-height: var(--leading-small);
}
.attached .listingchip {
  background: var(--color-oat);
}
.msgbox {
  display: block;
  width: 100%;
  min-height: 76px;
  max-height: 40vh;
  resize: vertical;
}
.composebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.composebar .btn {
  flex: none;
}

/* ── Messages (SKI-336): one paper card, the list beside the open conversation ──
   The list is the board's 380 once the card is 1056 wide (a window of about 1350); narrower, 36%
   of the card and never under 300, so the conversation keeps room for its bubbles down to 901. */
.inbox {
  display: grid;
  grid-template-columns: clamp(300px, 36%, 380px) minmax(0, 1fr);
  height: calc(100dvh - 190px);
  min-height: 520px;
  overflow: hidden;
}
.ib-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 16px 12px;
  border-right: 1px solid var(--color-edge);
}
.ib-tabs {
  flex: none;
  padding: 0 4px;
}
.ib-rows {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  overflow-y: auto;
}
/* Nothing under « Non lues »: the words alone, as the in-list empty sets them. */
.ib-list .ib-none {
  padding: 56px 24px;
  color: var(--color-ink);
  font-size: var(--text-name);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-name);
  text-align: center;
}
/* A conversation in the list: its face, the title a Name, the time a Small in muted, the sub line
   a Small in muted, the last word a Small in ink 2, and a dot of rose's deep at its end while an
   answer waits. The open one on rose's soft. */
.ib-row {
  position: relative;
  display: flex;
  flex: none;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-16);
  color: inherit;
  text-decoration: none;
}
@media (hover: hover) {
  .ib-row:hover {
    background: var(--color-oat);
  }
}
.ib-row.on {
  background: var(--color-rose-soft);
}
.ib-row:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: -2px;
}
.ib-row-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.ib-row-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.ib-row-top b {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--color-ink);
  font-size: var(--text-name);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-name);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ib-row-top time,
.ib-row-sub {
  color: var(--color-muted);
  font-size: var(--text-small);
  line-height: var(--leading-small);
}
.ib-row-top time {
  flex: none;
}
.ib-row-snip {
  overflow: hidden;
  color: var(--color-ink-2);
  font-size: var(--text-small);
  line-height: var(--leading-small);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ib-row.unread .ib-row-snip {
  padding-right: 16px;
}
.ib-dot {
  position: absolute;
  right: 16px;
  bottom: calc(14px + (var(--text-small) * 1.4 - 8px) / 2);
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-rose-deep);
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
/* SkinSouk's face: Nejma in a circle of rose's tint; a request's: its product's picture on oat. */
.ib-face {
  flex: none;
  box-sizing: border-box;
  width: 40px;
  height: 40px;
  padding: 1px;
  border-radius: var(--radius-pill);
  background: var(--color-rose-tint);
  object-fit: contain;
}
.ib-face.prod {
  padding: 0;
  border: 0;
  border-radius: var(--radius-16);
  background: var(--color-oat);
}
.ib-face.noimg .ph {
  width: 18px;
  height: 18px;
}

/* The pane beside the list: nothing open, or a conversation: its head, the conversation on oat,
   the answer box. */
.ib-conv {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  min-height: 0;
  padding: 20px 24px 24px;
}
.ib-head {
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
}
.ib-head-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ib-head-main b {
  overflow: hidden;
  color: var(--color-ink);
  font-size: var(--text-name);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-name);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ib-head-main span {
  color: var(--color-muted);
  font-size: var(--text-small);
  line-height: var(--leading-small);
}
.ib-back {
  display: none;
}
.ib-scroll {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
  border-radius: var(--radius-16);
  background: var(--color-oat);
}
.ib-conv .composer {
  flex: none;
}
/* Kawtar's conversation before its first message: the line icon, a Name, a Small in muted. */
.conv-empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 40px 24px;
  text-align: center;
}
.conv-empty .ph-duotone {
  width: 24px;
  height: 24px;
  margin-bottom: 8px;
  color: var(--color-ink);
}
.conv-empty b {
  color: var(--color-ink);
  font-size: var(--text-name);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-name);
}
.conv-empty span {
  max-width: 46ch;
  color: var(--color-muted);
  font-size: var(--text-small);
  line-height: var(--leading-small);
}
/* Nothing open: the line icon, a Name, a Small in muted, the quiet « Écrire à Kawtar ». */
.ib-pick {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 24px;
  text-align: center;
}
.ib-pick .ph-duotone {
  width: 24px;
  height: 24px;
  margin-bottom: 8px;
  color: var(--color-ink);
}
.ib-pick b {
  color: var(--color-ink);
  font-size: var(--text-name);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-name);
}
.ib-pick > span {
  max-width: 360px;
  color: var(--color-muted);
  font-size: var(--text-small);
  line-height: var(--leading-small);
}
.ib-pick .btn {
  margin-top: 16px;
}

/* ── under 900: the list, or one conversation with its round way back (inboxPhone, threadPhone) ── */
@media (max-width: 900px) {
  .inbox {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 0;
  }
  .inbox.has-open .ib-list,
  .inbox:not(.has-open) .ib-conv {
    display: none;
  }
  .ib-list {
    padding: 16px 8px;
    border-right: 0;
  }
  .ib-tabs {
    padding: 0 8px;
  }
  .ib-conv {
    gap: 16px;
    padding: 16px;
  }
  .ib-scroll {
    padding: 16px;
  }
  .ib-back {
    display: inline-grid;
    width: var(--spacing-control);
    height: var(--spacing-control);
  }
  .ib-head .btn {
    display: none;
  }
  /* A request's state goes under its name, which keeps the row (108: the way back, the picture
     and their gaps). */
  .ib-head {
    flex-wrap: wrap;
    row-gap: 6px;
  }
  .ib-head-main {
    flex-basis: calc(100% - 108px);
  }
  .ib-head .pill {
    margin-left: 108px;
  }
}

/* ── under 600: a request's head wraps, the field goes above its button, the chips wrap ── */
@media (max-width: 600px) {
  .ticket {
    padding: 16px;
  }
  .thead {
    flex-wrap: wrap;
  }
  .thead > div {
    flex: 1 1 60%;
  }
  .resend {
    flex-wrap: wrap;
  }
  .resend .input {
    flex: 1 1 100%;
  }
  .msg {
    max-width: 90%;
  }
  .conv .conv-messages {
    padding: 12px;
  }
}
