/* ============================================================================
   Kabstour — Messages: the community feed
   ----------------------------------------------------------------------------
   Mobile-first: every rule here is the phone layout, and the wider screens are
   additions at the bottom. That order is deliberate — the previous screens in
   this product were written desktop-first and shipped with no media query at
   all, which is how a resource card ended up wrapping a name one letter per
   line on a phone.

   Colour tokens are the client's own, read out of the mockup: coral-red brand,
   white surfaces, and the dark set the mockup also defines. Dark mode follows
   the device setting; nothing here assumes light.

   Touch targets are 44px minimum, per the brief.
   ========================================================================= */

:root {
  --kc-bg: #F5F6F8;
  --kc-card: #ffffff;
  --kc-ink: #1C2030;
  --kc-mute: #6A7085;
  --kc-line: #E6E8EE;
  --kc-brand: #F2452D;
  --kc-brand-d: #D93720;
  --kc-tint: #FDECE9;
  --kc-ok: #14A06F;
  --kc-ok-t: #E3F6EE;
  --kc-warn: #B7791F;
  --kc-warn-t: #FFF4DC;
  --kc-r: 14px;
  --kc-r-sm: 10px;
  --kc-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --kc-ease: cubic-bezier(.2, .7, .3, 1);
}




/* ---------------------------------------------------------------------------
   No automatic dark mode. Deliberate.
   ---------------------------------------------------------------------------
   These components used to honour prefers-color-scheme, and the result was
   worse than having no dark mode at all: on a device set to dark, the Messages
   and Community panels went dark while every other screen in the portal
   stayed light, because nothing else in this product has a dark theme. The
   page ended up half one thing and half the other.

   Dark mode is a product-wide decision, not a per-component one. When it is
   wanted it should be switched by a class or data attribute on <html> that
   every stylesheet reads, so the whole page changes together and the user
   chooses it rather than their operating system choosing for them.

   The tokens below are the light values, full stop.
   --------------------------------------------------------------------------- */

/* ---------------------------------------------------------------------------
   Shared bits
   --------------------------------------------------------------------------- */

.kp-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.kp-btn-primary,
.kp-btn-ghost,
.kp-btn-more {
  min-height: 44px;
  padding: 11px 18px;
  border-radius: var(--kc-r-sm);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 140ms var(--kc-ease), border-color 140ms var(--kc-ease);
}

.kp-btn-primary {
  background: var(--kc-brand);
  border: 1px solid var(--kc-brand);
  color: #fff;
}

.kp-btn-primary:hover { background: var(--kc-brand-d); border-color: var(--kc-brand-d); color: #fff; }

.kp-btn-ghost {
  background: transparent;
  border: 1px solid var(--kc-line);
  color: var(--kc-mute);
}

.kp-btn-ghost:hover { background: var(--kc-bg); }

.kp-btn-primary:focus-visible,
.kp-btn-ghost:focus-visible,
.kp-btn-more:focus-visible {
  outline: 2px solid var(--kc-brand);
  outline-offset: 2px;
}

.kp-field-error {
  color: var(--kc-brand-d);
  font-size: 13px;
  margin: 6px 0 0;
}

.kp-inline-form { display: inline; }

.kp-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--kc-mute);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.kp-back svg { width: 18px; height: 18px; }
.kp-back:hover { color: var(--kc-brand); }

/* ---------------------------------------------------------------------------
   Composer
   --------------------------------------------------------------------------- */

.kp-composer {
  background: var(--kc-card);
  border: 1px solid var(--kc-line);
  border-radius: var(--kc-r);
  box-shadow: var(--kc-shadow);
  margin-bottom: 16px;
  overflow: hidden;
}

.kp-composer-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 12px 14px;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  color: var(--kc-mute);
  font-size: 14.5px;
}

.kp-composer-trigger img { border-radius: 50%; flex: none; object-fit: cover; }
.kp-composer-trigger:hover { background: var(--kc-bg); }

/* The form is hidden until the box is opened, and the trigger hides once it
   is. Driven by one class so the server can render it already open after a
   failed submit. */
.kp-composer .kp-composer-form { display: none; }
.kp-composer.is-open .kp-composer-form { display: block; padding: 14px; }
.kp-composer.is-open .kp-composer-trigger { display: none; }

.kp-composer-types {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

/* No JavaScript in the type chooser: a checked radio styles its own label. */
.kp-type {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--kc-line);
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--kc-mute);
  cursor: pointer;
  margin: 0;
}

.kp-type input { position: absolute; opacity: 0; pointer-events: none; }
.kp-type svg { width: 14px; height: 14px; }
.kp-type:has(input:checked) { background: var(--kc-tint); border-color: var(--kc-brand); color: var(--kc-brand-d); }
.kp-type:has(input:focus-visible) { outline: 2px solid var(--kc-brand); outline-offset: 2px; }
.kp-type.is-locked { opacity: .55; cursor: not-allowed; }

.kp-composer-hint {
  font-size: 13px;
  color: var(--kc-mute);
  margin: 0 0 10px;
}

.kp-composer-hint a { color: var(--kc-brand); font-weight: 600; }

.kp-composer-body,
.kp-composer-field input,
.kp-reply textarea,
.kp-dialog-note textarea {
  width: 100%;
  border: 1px solid var(--kc-line);
  border-radius: var(--kc-r-sm);
  background: var(--kc-card);
  color: var(--kc-ink);
  font-size: 15px;
  padding: 11px 13px;
  min-height: 44px;
}

.kp-composer-body { resize: vertical; min-height: 96px; }

.kp-composer-body:focus,
.kp-composer-field input:focus,
.kp-reply textarea:focus,
.kp-dialog-note textarea:focus {
  outline: none;
  border-color: var(--kc-brand);
  box-shadow: 0 0 0 3px rgba(242, 69, 45, .14);
}

.kp-composer-row { display: grid; grid-template-columns: 1fr; gap: 10px; }
.kp-composer-field { margin-top: 10px; }

.kp-composer-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--kc-mute);
  margin-bottom: 5px;
}

.kp-composer-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.kp-composer-attach {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px dashed var(--kc-line);
  border-radius: var(--kc-r-sm);
  font-size: 13.5px;
  color: var(--kc-mute);
  cursor: pointer;
  margin: 0;
}

.kp-composer-attach input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.kp-composer-attach svg { width: 17px; height: 17px; }
.kp-composer-attach:has(input:focus-visible) { outline: 2px solid var(--kc-brand); outline-offset: 2px; }

.kp-composer-buttons { display: flex; gap: 8px; margin-left: auto; }

.kp-composer-note {
  font-size: 12px;
  color: var(--kc-mute);
  margin: 10px 0 0;
}

/* ---------------------------------------------------------------------------
   Filter chips and search
   --------------------------------------------------------------------------- */

.kp-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  /* On a phone the chips scroll sideways inside their own strip rather than
     wrapping to three rows and pushing the feed down. */
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.kp-chips::-webkit-scrollbar { display: none; }

.kp-chip-filter {
  flex: none;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 8px 15px;
  border: 1px solid var(--kc-line);
  border-radius: 999px;
  background: var(--kc-card);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--kc-mute);
  text-decoration: none;
  white-space: nowrap;
}

.kp-chip-filter:hover { border-color: var(--kc-brand); color: var(--kc-brand); }
.kp-chip-filter.is-on { background: var(--kc-brand); border-color: var(--kc-brand); color: #fff; }
.kp-chip-filter:focus-visible { outline: 2px solid var(--kc-brand); outline-offset: 2px; }

.kp-search { position: relative; margin-bottom: 16px; }

.kp-search svg {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--kc-mute);
  pointer-events: none;
}

.kp-search input {
  width: 100%;
  min-height: 46px;
  padding: 11px 40px 11px 40px;
  border: 1px solid var(--kc-line);
  border-radius: var(--kc-r-sm);
  background: var(--kc-card);
  color: var(--kc-ink);
  font-size: 15px;
}

.kp-search input:focus {
  outline: none;
  border-color: var(--kc-brand);
  box-shadow: 0 0 0 3px rgba(242, 69, 45, .14);
}

.kp-search-clear {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  color: var(--kc-mute);
  text-decoration: none;
  font-size: 22px;
  line-height: 1;
}

.kp-result-line { font-size: 13.5px; color: var(--kc-mute); margin: 0 0 12px; }

/* ---------------------------------------------------------------------------
   A post
   --------------------------------------------------------------------------- */

.kp-feed { display: flex; flex-direction: column; gap: 14px; }
.kp-pinned { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }

.kp-post {
  background: var(--kc-card);
  border: 1px solid var(--kc-line);
  border-radius: var(--kc-r);
  box-shadow: var(--kc-shadow);
  padding: 14px;
  /* Long words, URLs and pasted text must not widen the card. */
  overflow-wrap: anywhere;
}

.kp-post-pinned { border-color: var(--kc-brand); }

.kp-post-pin,
.kp-post-notice {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 10px;
}

.kp-post-pin { color: var(--kc-brand-d); }
.kp-post-pin svg { width: 15px; height: 15px; }

.kp-post-notice {
  background: var(--kc-warn-t);
  color: var(--kc-warn);
  padding: 9px 11px;
  border-radius: var(--kc-r-sm);
  font-weight: 500;
}

.kp-post-head { display: flex; align-items: flex-start; gap: 11px; }

.kp-post-avatar { flex: none; }

.kp-post-avatar img {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--kc-bg);
}

/* min-width:0 or a long name stops the row from shrinking and the menu
   button gets pushed off the card. */
.kp-post-who { flex: 1; min-width: 0; }

.kp-post-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.kp-post-name {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--kc-ink);
}

.kp-post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 12.5px;
  color: var(--kc-mute);
  margin-top: 3px;
}

.kp-post-dot { opacity: .5; }

.kp-chip,
.kp-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.kp-chip svg, .kp-tag svg { width: 12px; height: 12px; }

.kp-chip-employer { background: rgba(14, 165, 233, .12); color: #0369A1; }
.kp-chip-resource { background: rgba(99, 102, 241, .12); color: #4338CA; }
.kp-chip-verified { background: var(--kc-ok-t); color: var(--kc-ok); }
/* Kabstour itself. The company, not a party to the deal. */
.kp-chip-official { background: rgba(234, 88, 12, .12); color: #C2410C; }

.kp-tag-amber  { background: var(--kc-warn-t); color: var(--kc-warn); }
.kp-tag-blue   { background: rgba(14, 165, 233, .12); color: #0369A1; }
.kp-tag-green  { background: var(--kc-ok-t); color: var(--kc-ok); }
.kp-tag-violet { background: rgba(124, 58, 237, .12); color: #6D28D9; }
.kp-tag-teal   { background: rgba(13, 148, 136, .12); color: #0F766E; }
.kp-tag-grey   { background: var(--kc-bg); color: var(--kc-mute); }
.kp-tag-solved { background: var(--kc-ok-t); color: var(--kc-ok); }



/* Options menu */
.kp-post-menu { position: relative; flex: none; }

.kp-post-menu-btn {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent;
  color: var(--kc-mute);
  cursor: pointer;
  border-radius: var(--kc-r-sm);
  list-style: none;
}

.kp-post-menu-btn::-webkit-details-marker { display: none; }
.kp-post-menu-btn::marker { content: ""; }
.kp-post-menu-btn svg { width: 20px; height: 20px; }
.kp-post-menu-btn:hover { background: var(--kc-bg); color: var(--kc-ink); }
.kp-post-menu-btn:focus-visible { outline: 2px solid var(--kc-brand); outline-offset: -2px; }

.kp-post-menu-list {
  position: absolute;
  top: 46px; right: 0;
  z-index: 20;
  min-width: 190px;
  background: var(--kc-card);
  border: 1px solid var(--kc-line);
  border-radius: var(--kc-r-sm);
  box-shadow: 0 8px 28px rgba(16, 24, 40, .14);
  padding: 5px;
}

.kp-post-menu-item {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 14px;
  color: var(--kc-ink);
  border-radius: 7px;
  cursor: pointer;
}

.kp-post-menu-item:hover { background: var(--kc-bg); }
.kp-post-menu-danger { color: var(--kc-brand-d); }

/* Body */
.kp-post-body {
  margin-top: 11px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--kc-ink);
  white-space: pre-wrap;
}

.kp-post-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 8;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kp-post-more {
  display: inline-block;
  margin-top: 5px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--kc-brand);
  text-decoration: none;
}

.kp-post-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.kp-post-fact,
.kp-post-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: var(--kc-mute);
  text-decoration: none;
}

.kp-post-fact svg { width: 14px; height: 14px; }
.kp-post-tag { color: var(--kc-brand); font-weight: 500; }

/* Images. One column on a phone; a grid once there is room. */
.kp-post-media {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 12px;
  border-radius: var(--kc-r-sm);
  overflow: hidden;
}

.kp-post-image { display: block; line-height: 0; }

.kp-post-image img {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: cover;
  background: var(--kc-bg);
}

.kp-post-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 11px;
  padding: 9px 12px;
  border: 1px solid var(--kc-line);
  border-radius: var(--kc-r-sm);
  font-size: 13px;
  color: var(--kc-mute);
  text-decoration: none;
  max-width: 100%;
}

.kp-post-link svg { width: 16px; height: 16px; flex: none; }
.kp-post-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kp-post-link:hover { border-color: var(--kc-brand); color: var(--kc-brand); }

.kp-safety {
  display: flex;
  gap: 8px;
  margin: 12px 0 0;
  padding: 10px 12px;
  background: var(--kc-warn-t);
  color: var(--kc-warn);
  border-radius: var(--kc-r-sm);
  font-size: 12.5px;
  line-height: 1.5;
  font-weight: 500;
}

.kp-safety svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }

/* Actions */
.kp-post-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--kc-line);
}

.kp-act {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  min-height: 44px;
  padding: 8px 6px;
  border: 0;
  background: transparent;
  border-radius: var(--kc-r-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--kc-mute);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms var(--kc-ease), color 140ms var(--kc-ease);
}

.kp-act svg { width: 18px; height: 18px; flex: none; }
.kp-act:hover { background: var(--kc-bg); color: var(--kc-ink); }
.kp-act:focus-visible { outline: 2px solid var(--kc-brand); outline-offset: -2px; }
.kp-act.is-on { color: var(--kc-brand); }
.kp-act.is-on svg { fill: rgba(242, 69, 45, .14); }
.kp-act-count { font-variant-numeric: tabular-nums; font-weight: 600; }

/* On a phone, four or five labels cannot fit across the row: measured at
   390px they wrapped to "Lik e" and "Co mm ent". Below 576px the icons carry
   the meaning on screen.

   The labels are hidden the accessible way, not with display:none -- that
   would take them out of the accessibility tree too and leave a screen reader
   announcing an unlabelled button. This keeps "Like", "Comment", "Share" and
   "Save" being read out while showing only the icon. */
@media (max-width: 575.98px) {
  .kp-act-label {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  /* Without labels the row has room to breathe, and each target stays well
     over the 44px minimum. */
  .kp-act { gap: 4px; padding: 8px 4px; }
  .kp-act svg { width: 20px; height: 20px; }
}

/* ---------------------------------------------------------------------------
   Thread
   --------------------------------------------------------------------------- */

.kp-thread {
  margin-top: 16px;
  background: var(--kc-card);
  border: 1px solid var(--kc-line);
  border-radius: var(--kc-r);
  box-shadow: var(--kc-shadow);
  padding: 14px;
}

.kp-thread-title { font-size: 16px; font-weight: 600; margin: 0 0 14px; color: var(--kc-ink); }

.kp-reply { margin-bottom: 18px; }
.kp-reply-hint { font-size: 12.5px; color: var(--kc-brand); margin: 0 0 6px; font-weight: 500; }
.kp-reply-row { display: flex; gap: 10px; align-items: flex-start; }
.kp-reply textarea { resize: vertical; min-height: 44px; }
.kp-reply-buttons { display: flex; gap: 8px; justify-content: flex-end; margin-top: 9px; }

.kp-comments { display: flex; flex-direction: column; gap: 14px; }
.kp-comments-empty { font-size: 14px; color: var(--kc-mute); margin: 0; }

.kp-comment { display: flex; gap: 10px; align-items: flex-start; }

.kp-comment-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--kc-bg);
}

.kp-comment-main { flex: 1; min-width: 0; }

.kp-comment-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.kp-comment-name { font-weight: 600; font-size: 13.5px; color: var(--kc-ink); }
.kp-comment-time { font-size: 12px; color: var(--kc-mute); }

.kp-comment-body {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--kc-ink);
  margin-top: 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.kp-comment-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

.kp-comment-act {
  min-height: 36px;
  padding: 7px 9px;
  border: 0;
  background: transparent;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--kc-mute);
  border-radius: 7px;
  cursor: pointer;
}

.kp-comment-act:hover { background: var(--kc-bg); color: var(--kc-ink); }
.kp-comment-act.is-on { color: var(--kc-ok); }
.kp-comment-act:focus-visible { outline: 2px solid var(--kc-brand); outline-offset: -2px; }

.kp-comment.is-solution > .kp-comment-main {
  background: var(--kc-ok-t);
  border-radius: var(--kc-r-sm);
  padding: 10px 12px;
}

.kp-comment-replies {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
  padding-left: 12px;
  border-left: 2px solid var(--kc-line);
}

/* ---------------------------------------------------------------------------
   Empty, loading, dialog
   --------------------------------------------------------------------------- */

.kp-empty {
  text-align: center;
  padding: 44px 20px;
  background: var(--kc-card);
  border: 1px solid var(--kc-line);
  border-radius: var(--kc-r);
}

.kp-empty svg { width: 42px; height: 42px; color: var(--kc-mute); opacity: .5; }
.kp-empty h3 { font-size: 17px; font-weight: 600; margin: 12px 0 6px; color: var(--kc-ink); }
.kp-empty p { font-size: 14px; color: var(--kc-mute); margin: 0; max-width: 42ch; margin-inline: auto; }

.kp-feed-more { display: flex; justify-content: center; padding: 18px 0; }

.kp-btn-more {
  background: var(--kc-card);
  border: 1px solid var(--kc-line);
  color: var(--kc-ink);
}

.kp-feed-spinner { font-size: 13.5px; color: var(--kc-mute); }

.kp-dialog {
  width: min(520px, calc(100vw - 32px));
  border: 0;
  border-radius: var(--kc-r);
  padding: 0;
  background: var(--kc-card);
  color: var(--kc-ink);
  box-shadow: 0 24px 60px rgba(16, 24, 40, .24);
}

.kp-dialog::backdrop { background: rgba(16, 24, 40, .5); }
.kp-dialog-form { padding: 20px; }
.kp-dialog-title { font-size: 18px; font-weight: 600; margin: 0 0 6px; }
.kp-dialog-sub { font-size: 13.5px; color: var(--kc-mute); margin: 0 0 14px; line-height: 1.5; }
.kp-dialog-reasons { border: 0; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 2px; }

.kp-radio {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: var(--kc-r-sm);
  font-size: 14px;
  cursor: pointer;
  margin: 0;
}

.kp-radio:hover { background: var(--kc-bg); }
.kp-radio input { width: 18px; height: 18px; accent-color: var(--kc-brand); flex: none; }

.kp-dialog-note { display: block; }
.kp-dialog-note span { display: block; font-size: 13px; color: var(--kc-mute); margin-bottom: 5px; }
.kp-dialog-note textarea { resize: vertical; }
.kp-dialog-buttons { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ---------------------------------------------------------------------------
   Wider screens
   --------------------------------------------------------------------------- */

@media (min-width: 576px) {
  .kp-post, .kp-thread, .kp-composer.is-open .kp-composer-form { padding: 18px; }
  .kp-composer-row { grid-template-columns: 1fr 1fr; }

  /* Image grids only once there is room for them to be legible. */
  .kp-post-media-2,
  .kp-post-media-4 { grid-template-columns: 1fr 1fr; }

  .kp-post-media-3,
  .kp-post-media-5 { grid-template-columns: 1fr 1fr 1fr; }

  .kp-post-media-3 .kp-post-image:first-child,
  .kp-post-media-5 .kp-post-image:first-child { grid-column: span 3; }

  .kp-post-media-5 .kp-post-image:nth-child(2),
  .kp-post-media-5 .kp-post-image:nth-child(3) { grid-column: span 1; }

  .kp-post-media img { max-height: 300px; }
  .kp-post-media-1 img { max-height: 480px; }

  .kp-act { flex: 0 0 auto; padding: 8px 14px; }
  .kp-post-actions { gap: 4px; }
}

@media (min-width: 992px) {
  .kp-post, .kp-thread { padding: 20px; }
  .kp-post-body { font-size: 15.5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}

/* ============================================================================
   Messages — private chat
   ----------------------------------------------------------------------------
   Phone: one pane at a time. The list IS the screen; opening a conversation
   replaces it, and the thread header carries a back arrow. The server adds
   .has-thread, so which pane shows is decided before any JavaScript runs and
   there is no flash of the wrong one.

   Desktop: list and thread side by side, and the back arrow is hidden because
   there is nothing to go back to.

   Refinement pass, 5 Nov: tighter vertical rhythm in the list, an active row
   that is unmistakable rather than merely tinted, real presence dots, message
   groups that breathe, and a composer that looks like one.
   ========================================================================= */

.kp-msg {
  display: block;
  background: var(--kc-card);
  border: 1px solid var(--kc-line);
  border-radius: var(--kc-r);
  box-shadow: var(--kc-shadow);
  overflow: hidden;
}

/* ---------------------------------------------------------------------------
   The list
   --------------------------------------------------------------------------- */

.kp-msg-list { display: block; background: var(--kc-card); }
.kp-msg.has-thread .kp-msg-list { display: none; }

.kp-msg-search {
  position: relative;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--kc-line);
}

.kp-msg-search svg {
  position: absolute;
  left: 27px; top: calc(50% + 1px);
  transform: translateY(-50%);
  width: 17px; height: 17px;
  color: var(--kc-mute);
  pointer-events: none;
}

.kp-msg-search input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px 10px 38px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--kc-bg);
  color: var(--kc-ink);
  font-size: 14px;
  transition: background-color .14s var(--kc-ease), border-color .14s var(--kc-ease), box-shadow .14s var(--kc-ease);
}

.kp-msg-search input::placeholder { color: var(--kc-mute); }

.kp-msg-search input:focus {
  outline: none;
  background: var(--kc-card);
  border-color: var(--kc-brand);
  box-shadow: 0 0 0 3px rgba(242, 69, 45, .12);
}

.kp-msg-rows { display: flex; flex-direction: column; padding: 6px; gap: 2px; }

/* Each row is its own rounded target rather than a full-width band with a
   hairline under it. Less furniture, and the active one can then be a shape
   rather than just a colour change. */
.kp-msg-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  min-height: 68px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: background-color .14s var(--kc-ease);
}

.kp-msg-row:hover { background: var(--kc-bg); }

/* The open conversation: tint, a coral spine, and a heavier name. Tint alone
   was easy to miss against a white list on a bright screen. */
.kp-msg-row.is-open { background: var(--kc-tint); }

.kp-msg-row.is-open::before {
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--kc-brand);
}

.kp-msg-row.is-open .kp-msg-row-name { color: var(--kc-brand-d); }
.kp-msg-row:focus-visible { outline: 2px solid var(--kc-brand); outline-offset: -2px; }

/* Avatar, with room for the presence dot to sit on its corner. */
.kp-msg-avatar { position: relative; flex: none; width: 44px; height: 44px; }

.kp-msg-avatar img {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--kc-bg);
  display: block;
}

/* Real presence: a 3-minute window from the cache the app already keeps.
   The ring is the card colour so the dot reads as sitting on top of the
   avatar rather than punched into it. */
.kp-presence {
  position: absolute;
  right: -1px; bottom: -1px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--kc-mute);
  box-shadow: 0 0 0 2.5px var(--kc-card);
}

.kp-presence.is-online { background: var(--kc-ok); }
.kp-msg-row.is-open .kp-presence { box-shadow: 0 0 0 2.5px var(--kc-tint); }

/* min-width:0 or a long name stops this column shrinking and the badge is
   pushed off the row. */
.kp-msg-row-main { flex: 1; min-width: 0; }

.kp-msg-row-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.kp-msg-row-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--kc-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kp-msg-row-top time {
  flex: none;
  font-size: 11.5px;
  color: var(--kc-mute);
  font-variant-numeric: tabular-nums;
}

.kp-msg-row-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}

.kp-msg-row-last {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--kc-mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kp-msg-row.is-unread .kp-msg-row-last { color: var(--kc-ink); font-weight: 500; }
.kp-msg-row.is-unread .kp-msg-row-name { font-weight: 700; }
.kp-msg-row.is-unread .kp-msg-row-top time { color: var(--kc-brand); font-weight: 600; }

.kp-msg-unread {
  flex: none;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--kc-brand);
  color: #fff;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* The role badge sits ON the preview line, not below it. It used to take a
   third row, which made every entry tall and the list look sparse. */
.kp-msg-row-main > .kp-chip { display: none; }

.kp-msg-role {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--kc-mute);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.kp-msg-settings-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 4px 6px 6px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--kc-mute);
  text-decoration: none;
}

.kp-msg-settings-link svg { width: 16px; height: 16px; }
.kp-msg-settings-link:hover { background: var(--kc-bg); color: var(--kc-ink); }

.kp-empty-sm { padding: 38px 20px; border: 0; }
.kp-empty-sm .kp-btn-primary { display: inline-block; margin-top: 14px; text-decoration: none; }

/* ---------------------------------------------------------------------------
   The thread
   --------------------------------------------------------------------------- */

.kp-msg-thread { display: none; background: var(--kc-card); }
.kp-msg.has-thread .kp-msg-thread { display: block; }

.kp-msg-blank {
  display: none;
  text-align: center;
  padding: 56px 28px;
  color: var(--kc-mute);
}

/* The icon sits in a soft disc so it reads as an illustration rather than a
   stray glyph floating in white space. */
.kp-msg-blank-art {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--kc-tint);
  color: var(--kc-brand);
  margin-bottom: 18px;
}

.kp-msg-blank-art svg { width: 32px; height: 32px; }

.kp-msg-blank h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--kc-ink);
  margin: 0 0 8px;
}

.kp-msg-blank p {
  margin: 0 auto;
  font-size: 14.5px;
  line-height: 1.6;
  max-width: 38ch;
}

.kp-msg-blank-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 22px;
}

.kp-msg-blank-actions a { text-decoration: none; display: inline-flex; align-items: center; }

.kp-msg-blank-tips {
  list-style: none;
  margin: 28px auto 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--kc-line);
  max-width: 34ch;
  text-align: left;
  font-size: 13px;
  line-height: 1.7;
}

.kp-msg-blank-tips li { position: relative; padding-left: 20px; }

.kp-msg-blank-tips li::before {
  content: "";
  position: absolute;
  left: 4px; top: 10px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--kc-brand);
  opacity: .5;
}

/*
 * On a phone the thread IS the screen, so it fills it. dvh rather than vh
 * because mobile browser chrome slides away and vh does not notice, which
 * leaves the composer under the address bar.
 */
.kp-thread-wrap {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 150px);
  min-height: 420px;
}

.kp-thread-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--kc-line);
  background: var(--kc-card);
  flex: none;
}

.kp-thread-back {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  color: var(--kc-ink);
  flex: none;
  border-radius: 10px;
  margin-left: -6px;
}

.kp-thread-back svg { width: 22px; height: 22px; }
.kp-thread-back:hover { background: var(--kc-bg); }

.kp-thread-avatar-wrap { position: relative; flex: none; width: 40px; height: 40px; }

.kp-thread-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--kc-bg);
  display: block;
}

.kp-thread-who { flex: 1; min-width: 0; }

.kp-thread-name {
  display: block;
  font-weight: 600;
  font-size: 15px;
  color: var(--kc-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}

.kp-thread-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--kc-mute);
}

.kp-thread-status { display: inline-flex; align-items: center; gap: 5px; }
.kp-thread-status::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--kc-mute);
}
.kp-thread-status.is-online { color: var(--kc-ok); font-weight: 600; }
.kp-thread-status.is-online::before { background: var(--kc-ok); }

/* Context card */
.kp-thread-context {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--kc-bg);
  border-bottom: 1px solid var(--kc-line);
  flex: none;
}

.kp-thread-context-main { flex: 1; min-width: 0; }

.kp-thread-context-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--kc-brand);
}

.kp-thread-context-title {
  display: block;
  font-size: 13.5px;
  color: var(--kc-ink);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kp-thread-context.is-gone .kp-thread-context-title { color: var(--kc-mute); font-style: italic; }

.kp-thread-context-open {
  flex: none;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border: 1px solid var(--kc-line);
  border-radius: 999px;
  background: var(--kc-card);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--kc-ink);
  text-decoration: none;
  transition: border-color .14s var(--kc-ease), color .14s var(--kc-ease);
}

.kp-thread-context-open:hover { border-color: var(--kc-brand); color: var(--kc-brand); }

.kp-safety-thread { margin: 0; border-radius: 0; flex: none; }

/* ---------------------------------------------------------------------------
   Bubbles
   --------------------------------------------------------------------------- */

.kp-bubbles {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--kc-bg);
  scrollbar-width: thin;
}

.kp-bubbles::-webkit-scrollbar { width: 8px; }
.kp-bubbles::-webkit-scrollbar-thumb {
  background: rgba(106, 112, 133, .25);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

/* A line at the top so a short conversation does not open on a wall of
   nothing, and so you can tell you are at the beginning rather than scrolled
   up into empty space. */
.kp-thread-start {
  align-self: center;
  margin: auto auto 18px;
  padding: 0 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--kc-mute);
  line-height: 1.6;
  max-width: 42ch;
}

.kp-thread-start strong { color: var(--kc-ink); font-weight: 600; }

.kp-bubbles-empty { text-align: center; color: var(--kc-mute); font-size: 14px; margin: auto; }

.kp-bubble { display: flex; max-width: 84%; }
.kp-bubble.is-mine { align-self: flex-end; justify-content: flex-end; }
.kp-bubble.is-theirs { align-self: flex-start; }

/* Consecutive messages from the same person group together: a bigger gap
   before a change of speaker, tighter corners within a run. */
.kp-bubble + .kp-bubble.is-mine:not(.is-mine + .is-mine) { margin-top: 10px; }
.kp-bubble + .kp-bubble.is-theirs:not(.is-theirs + .is-theirs) { margin-top: 10px; }

.kp-bubble-inner {
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--kc-card);
  border: 1px solid var(--kc-line);
  min-width: 0;
  box-shadow: 0 1px 1px rgba(16, 24, 40, .03);
}

.kp-bubble.is-mine .kp-bubble-inner {
  background: var(--kc-brand);
  border-color: var(--kc-brand);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 1px 2px rgba(242, 69, 45, .22);
}

.kp-bubble.is-theirs .kp-bubble-inner { border-bottom-left-radius: 6px; }

.kp-bubble.is-pending .kp-bubble-inner { opacity: .55; }
.kp-bubble.is-failed .kp-bubble-inner { background: var(--kc-mute); border-color: var(--kc-mute); box-shadow: none; }

.kp-bubble-text {
  font-size: 14.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* The time and the ticks are information you look for, not information you
   read, so they sit quiet and out of the way of the words. */
.kp-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 2px;
  font-size: 10.5px;
  line-height: 1.4;
  opacity: .6;
  font-variant-numeric: tabular-nums;
}

.kp-bubble.is-mine .kp-bubble-meta { color: #fff; opacity: .78; }
.kp-bubble-sending { font-size: 10.5px; }

.kp-ticks svg { width: 14px; height: 14px; display: block; }
.kp-ticks.is-read { color: #CDEBFF; opacity: 1; }
.kp-bubble.is-theirs .kp-ticks { display: none; }

.kp-bubble-image { display: block; line-height: 0; margin: -4px -6px 6px; }

.kp-bubble-image img {
  max-width: 100%;
  max-height: 280px;
  border-radius: 13px;
  object-fit: cover;
}

.kp-bubble-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.kp-bubble-file svg { width: 22px; height: 22px; flex: none; opacity: .85; }
.kp-bubble-file-main { min-width: 0; }

.kp-bubble-file-name {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kp-bubble-file-size { display: block; font-size: 11.5px; opacity: .75; }

/* A system message is an event, not something somebody typed. */
.kp-bubble.is-system { align-self: center; max-width: 100%; margin: 12px 0; }

.kp-bubble.is-system .kp-bubble-inner {
  background: transparent;
  border: 1px dashed var(--kc-line);
  color: var(--kc-mute);
  border-radius: 10px;
  text-align: center;
  font-size: 12.5px;
  box-shadow: none;
  padding: 9px 14px;
}

.kp-bubble.is-system .kp-bubble-meta { justify-content: center; opacity: .55; }
.kp-bubble.is-system .kp-ticks { display: none; }

/* ---------------------------------------------------------------------------
   Quick actions and the composer
   --------------------------------------------------------------------------- */

.kp-quick {
  display: flex;
  gap: 7px;
  padding: 10px 14px 0;
  overflow-x: auto;
  scrollbar-width: none;
  flex: none;
}

.kp-quick::-webkit-scrollbar { display: none; }

.kp-quick-btn {
  flex: none;
  min-height: 34px;
  padding: 7px 14px;
  border: 1px solid var(--kc-line);
  border-radius: 999px;
  background: var(--kc-card);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--kc-mute);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .14s var(--kc-ease), color .14s var(--kc-ease);
}

.kp-quick-btn:hover { border-color: var(--kc-brand); color: var(--kc-brand); }
.kp-quick-link { text-decoration: none; display: inline-flex; align-items: center; }

/* The composer is one rounded field with the attach and send controls inside
   it, rather than three separate things sitting in a row. */
.kp-send {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 12px 14px 14px;
  padding: 6px 6px 6px 8px;
  border: 1px solid var(--kc-line);
  border-radius: 24px;
  background: var(--kc-card);
  flex: none;
  transition: border-color .14s var(--kc-ease), box-shadow .14s var(--kc-ease);
}

/* :focus-within puts the focus ring on the whole composer, which is what the
   eye treats as the control, instead of on the bare textarea inside it. */
.kp-send:focus-within {
  border-color: var(--kc-brand);
  box-shadow: 0 0 0 3px rgba(242, 69, 45, .12);
}

.kp-send-attach {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--kc-mute);
  cursor: pointer;
  flex: none;
  margin: 0;
  transition: background-color .14s var(--kc-ease), color .14s var(--kc-ease);
}

.kp-send-attach input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.kp-send-attach svg { width: 19px; height: 19px; }
.kp-send-attach:hover { background: var(--kc-bg); color: var(--kc-ink); }
.kp-send-attach:has(input:focus-visible) { outline: 2px solid var(--kc-brand); outline-offset: 2px; }

.kp-send textarea {
  flex: 1;
  min-height: 38px;
  max-height: 140px;
  padding: 9px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--kc-ink);
  font-size: 15px;
  font-family: inherit;
  line-height: 1.4;
  resize: none;
  overflow-y: auto;
}

.kp-send textarea:focus { outline: none; box-shadow: none; }
.kp-send textarea::placeholder { color: var(--kc-mute); }

.kp-send-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--kc-brand);
  color: #fff;
  cursor: pointer;
  flex: none;
  transition: background-color .14s var(--kc-ease), transform .14s var(--kc-ease);
}

.kp-send-btn svg { width: 18px; height: 18px; margin-left: -1px; }
.kp-send-btn:hover { background: var(--kc-brand-d); }
.kp-send-btn:active { transform: scale(.94); }
.kp-send-btn:focus-visible { outline: 2px solid var(--kc-brand); outline-offset: 2px; }

.kp-send-file {
  margin: 0;
  padding: 0 20px 12px;
  font-size: 12.5px;
  color: var(--kc-mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: none;
}

/* ---------------------------------------------------------------------------
   Side by side from the large breakpoint
   --------------------------------------------------------------------------- */

@media (min-width: 992px) {
  .kp-msg {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
  }

  /* Both panes are always present on a desktop, so .has-thread stops meaning
     anything here. */
  .kp-msg .kp-msg-list,
  .kp-msg.has-thread .kp-msg-list {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--kc-line);
    background: var(--kc-card);
  }

  /* flex, not block: the two-class selector outranks the plain .kp-msg-thread
     rule below, and as display:block it stopped the thread wrapper shrinking,
     so the scroll stayed stuck on the outer card. */
  .kp-msg .kp-msg-thread,
  .kp-msg.has-thread .kp-msg-thread {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .kp-msg-blank { display: block; }
  .kp-msg.has-thread .kp-msg-blank { display: none; }

  /* Nothing to go back to when the list is right there. */
  .kp-thread-back { display: none; }

  /*
   * The card is sized by its CONTENT, capped at the viewport -- max-height,
   * not height.
   *
   * It used to be a fixed calc(100vh - 170px). A four-message conversation
   * still got a 730px box: the bubbles were squeezed into 353px and scrolled
   * inside it, the card pushed the page down, and scrolling landed you in the
   * empty half. Two scrollbars for content that fits once.
   *
   * Now a short conversation makes a short card with nothing to scroll, and a
   * long one stops at the viewport and scrolls internally. min-height: 0 on
   * the panes is what lets a flex child shrink below its content so the
   * scroll happens in the right place.
   */
  .kp-msg {
    max-height: calc(100vh - 150px);
    min-height: 420px;
    /* A grid row sizes to its content by default and max-height on the
       container then CLIPS the overflow rather than constraining it.
       minmax(0, 1fr) lets the row shrink below its content, which is what
       pushes the scrolling down into the list and the bubbles where it
       belongs. */
    grid-template-rows: minmax(0, 1fr);
  }

  .kp-msg-list { min-height: 0; }
  .kp-msg-rows { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }

  .kp-msg-thread { min-height: 0; display: flex; flex-direction: column; }
  .kp-thread-wrap { flex: 1; min-height: 0; height: auto; }
  .kp-bubbles { flex: 1; min-height: 0; }
  .kp-bubble { max-width: 68%; }
  .kp-bubbles { padding: 22px 24px; }
  .kp-thread-head { padding: 14px 20px; }
  .kp-thread-context { padding: 12px 20px; }
  .kp-send { margin: 14px 20px 18px; }
  .kp-quick { padding: 12px 20px 0; }
}

@media (min-width: 1400px) {
  .kp-msg { grid-template-columns: 360px minmax(0, 1fr); }
  .kp-bubble { max-width: 62%; }
}

/* ---------------------------------------------------------------------------
   Notification settings
   --------------------------------------------------------------------------- */

.kp-settings {
  background: var(--kc-card);
  border: 1px solid var(--kc-line);
  border-radius: var(--kc-r);
  box-shadow: var(--kc-shadow);
  padding: 18px;
  margin-bottom: 16px;
}

.kp-settings-title { font-size: 17px; font-weight: 600; margin: 0 0 5px; color: var(--kc-ink); }
.kp-settings-sub { font-size: 13.5px; color: var(--kc-mute); margin: 0 0 16px; line-height: 1.5; }
.kp-settings-list { display: flex; flex-direction: column; gap: 2px; }
.kp-settings-actions { margin-top: 18px; }
.kp-settings-note { font-size: 12.5px; color: var(--kc-mute); margin: 0; }

/* A switch, built from a checkbox so it still works without JavaScript and
   keeps every keyboard and screen-reader behaviour a checkbox already has. */
.kp-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 2px;
  cursor: pointer;
  margin: 0;
}

.kp-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.kp-switch-track {
  flex: none;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--kc-line);
  position: relative;
  transition: background-color 160ms var(--kc-ease);
}

.kp-switch-dot {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .2);
  transition: transform 160ms var(--kc-ease);
}

.kp-switch input:checked + .kp-switch-track { background: var(--kc-ok); }
.kp-switch input:checked + .kp-switch-track .kp-switch-dot { transform: translateX(18px); }
.kp-switch input:focus-visible + .kp-switch-track { outline: 2px solid var(--kc-brand); outline-offset: 2px; }

.kp-switch-label { font-size: 14.5px; color: var(--kc-ink); }

.kp-muted-row {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 56px;
  padding: 8px 0;
  border-bottom: 1px solid var(--kc-line);
}

.kp-muted-row:last-child { border-bottom: 0; }
.kp-muted-row img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; background: var(--kc-bg); }
.kp-muted-name { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 500; color: var(--kc-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kp-btn-sm { min-height: 38px; padding: 8px 14px; font-size: 13px; }

/* The settings link is styled with the conversation list, above. */

/* ---------------------------------------------------------------------------
   Housing: composer fields and listing facts
   --------------------------------------------------------------------------- */

/* The housing block appears only when Property is the chosen type. :has() on
   the checked radio does this with no JavaScript, so it is correct before any
   script runs and still correct after a failed submit re-renders the form. */
.kp-housing { display: none; }
.kp-composer-form:has(.kp-type input[value="property"]:checked) .kp-housing { display: block; }

.kp-listing {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin: 12px 0 0;
  padding: 12px 14px;
  background: var(--kc-bg);
  border-radius: var(--kc-r-sm);
}

.kp-listing-item { min-width: 0; }

.kp-listing dt {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--kc-mute);
  margin: 0;
}

.kp-listing dd {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--kc-ink);
  overflow-wrap: anywhere;
}

.kp-listing-strong { font-size: 17px !important; font-weight: 700; }
.kp-listing-strong span { font-size: 12.5px; font-weight: 500; color: var(--kc-mute); }

/* Four facts in one row only once there is room to read them. */
@media (min-width: 576px) {
  .kp-listing { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------------------------------------------------------------------------
   Housing: requesting a viewing inside a chat
   --------------------------------------------------------------------------- */

.kp-viewing { border-top: 1px solid var(--kc-line); flex: none; }

.kp-viewing-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 12px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--kc-brand);
  list-style: none;
}

.kp-viewing-trigger::-webkit-details-marker { display: none; }
.kp-viewing-trigger::marker { content: ""; }
.kp-viewing-trigger svg { width: 17px; height: 17px; }
.kp-viewing-trigger:hover { background: var(--kc-bg); }
.kp-viewing-trigger:focus-visible { outline: 2px solid var(--kc-brand); outline-offset: -2px; }

.kp-viewing-form { padding: 0 12px 12px; }
.kp-viewing-row { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 10px; }
.kp-viewing-form .kp-composer-field span { display: block; font-size: 13px; font-weight: 500; color: var(--kc-mute); margin-bottom: 5px; }

.kp-viewing-form input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--kc-line);
  border-radius: var(--kc-r-sm);
  background: var(--kc-card);
  color: var(--kc-ink);
  font-size: 14.5px;
}

.kp-viewing-form input:focus {
  outline: none;
  border-color: var(--kc-brand);
  box-shadow: 0 0 0 3px rgba(242, 69, 45, .14);
}

@media (min-width: 576px) {
  .kp-viewing-row { grid-template-columns: 1fr 1fr; }
}

/* Context action links sit in the same strip as quick replies. */
/* .kp-quick-link and the system-message treatment are defined with the rest
   of the thread, above. A second copy here was quietly winning on source
   order and putting the old amber fill back on system messages. */

/* ─── THE COMPOSER, MADE TO LOOK LIKE A CONTROL ────────────────────────────
   It was a line of grey placeholder text in a plain white box, sitting four
   rows above an actual search field with grey placeholder text in a plain
   white box. The two read as the same thing, and the one that writes a post
   read as the one that does nothing. (Client, 9 Nov 2026: "make it more
   visible and distinguished".)

   Three changes, in order of how much work each does: a Post button on the
   right, so the row states what it is for; the prompt in ink rather than
   placeholder grey, because it is an invitation and not a hint; and a brand
   edge down the left, which separates it from every white card below it
   without adding another coloured block to the page. */

.kp-composer {
  border-left: 3px solid var(--kc-brand, #F7412B);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 6px 16px -6px rgba(16, 24, 40, .10);
}

.kp-composer-trigger {
  min-height: 68px;
  gap: 12px;
  color: var(--kc-ink, #1C2030);
  font-size: 15px;
  font-weight: 500;
}

.kp-composer-prompt {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  /* One line, with the end trimmed rather than wrapped: the prompt is a
     label for the control, not content to read. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kp-composer-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--kc-brand, #F7412B);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .12);
  transition: background .15s ease;
}

.kp-composer-cta svg { width: 16px; height: 16px; flex: none; }

.kp-composer-trigger:hover { background: #FFF6F4; }
.kp-composer-trigger:hover .kp-composer-cta { background: var(--kc-brand-dark, #C7331E); }
.kp-composer-trigger:focus-visible { outline: 2px solid var(--kc-brand, #F7412B); outline-offset: -2px; }

/* On a phone the prompt has to shorten before the button does: losing the
   end of a sentence you can guess costs less than losing the one word that
   says what the row does. */
@media (max-width: 479.98px) {
  .kp-composer-trigger { padding: 12px; gap: 10px; }
  .kp-composer-trigger img { width: 34px; height: 34px; }
  .kp-composer-prompt { font-size: 14px; }
  .kp-composer-cta { padding: 0 12px; height: 38px; }
  .kp-composer-cta-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
