:root {
  color-scheme: light;
  --ink: #14343c;
  --muted: #71868b;
  --cyan: #06b6c8;
  --cyan-dark: #078b9a;
  --line: #e5eeee;
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  background: #f7fbfb;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; }
.topbar { height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(22px, calc((100% - 1120px) / 2)); border-bottom: 1px solid var(--line); background: white; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font: 800 21px Manrope, sans-serif; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 12px; background: var(--cyan); color: white; }
.brand-mark img { display: block; width: 30px; height: 30px; }
.back-link { color: var(--cyan-dark); font-size: 13px; font-weight: 700; text-decoration: none; }
.chat-page { width: min(1120px, calc(100% - 40px)); margin: 34px auto 60px; }
.messages-page .chat-page { margin-bottom: 15px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-heading h1 { margin: 0; font: 800 30px Manrope, sans-serif; }
.eyebrow { margin: 0 0 5px; color: var(--cyan-dark); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
#chat-status { margin: 0; color: #a53d32; font-size: 13px; }
.notification-warning { margin: 0 0 14px; padding: 11px 14px; border: 1px solid #f1dfae; border-radius: 10px; background: #fff6df; color: #6b4e08; font-size: 12px; line-height: 1.5; }
.chat-layout { min-height: 580px; display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); overflow: clip; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 12px 35px rgba(27, 74, 81, .06); }
.conversation-panel { border-right: 1px solid var(--line); }
.conversation-panel-inner { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; padding: 18px 12px; }
.conversation-panel h2 { margin: 0 8px 12px; font: 800 16px Manrope, sans-serif; }
#conversation-list { display: grid; gap: 5px; }
.conversation-card { width: 100%; display: flex; align-items: center; gap: 11px; padding: 12px; border: 0; border-radius: 10px; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.conversation-card:hover, .conversation-card.is-active { background: #e8fbfc; }
.conversation-copy strong, .conversation-copy > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-copy strong { color: var(--ink); font-size: 13px; }
.conversation-copy > span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.conversation-copy > .conversation-meta { display: flex; align-items: baseline; gap: 8px; overflow: visible; font-size: 10px; }
.conversation-status { min-width: 0; margin-left: auto; overflow: hidden; color: var(--cyan-dark); font-weight: 700; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.conversation-status.is-unread { color: #b52c3b; }
.conversation-copy > .conversation-status { color: var(--cyan-dark); font-size: 11px; }
.conversation-copy > .conversation-status.is-unread { color: #b52c3b; }
.conversation-card .conversation-image, .conversation-image-placeholder { width: 54px; height: 54px; flex: 0 0 54px; border-radius: 9px; object-fit: cover; background: #e8f2f2; }
.conversation-copy { min-width: 0; flex: 1; }
.conversation-unread { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: #d83a4b; }
.chat-panel { position: relative; min-width: 0; min-height: 580px; display: flex; flex-direction: column; }
.chat-panel[aria-busy="true"] > :not(.chat-loading) { display: none !important; }
.chat-heading { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); background: white; }
.chat-heading > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.chat-heading h2 { margin: 0; font: 800 16px Manrope, sans-serif; }
.chat-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.seller-rating-link { display: inline-block; margin-top: 5px; color: var(--cyan-dark); font-size: 12px; font-weight: 700; }
.sale-panel { padding: 10px 20px; border-bottom: 1px solid var(--line); color: #31555a; font-size: 12px; }
.sale-panel form { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.sale-panel button { padding: 7px 10px; border: 1px solid #b9ecef; border-radius: 8px; background: #e8fbfc; color: var(--cyan-dark); font: 700 12px "DM Sans", sans-serif; }
.sale-panel button { cursor: pointer; }
.sale-panel button:disabled { opacity: .6; cursor: wait; }
.rating-stars { display: inline-flex; flex-direction: row-reverse; }
.rating-stars input { position: absolute; opacity: 0; }
.rating-stars label { color: #a9babb; font-size: 23px; cursor: pointer; }
.rating-stars input:checked ~ label, .rating-stars label:hover, .rating-stars label:hover ~ label { color: #06a6b5; }
.rating-stars input:focus-visible + label { outline: 2px solid #078b9a; outline-offset: 2px; }
.rating-confirm-dialog .rating-confirm-score { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 10px; background: #e8fbfc; color: #176f79; font-size: 16px; font-weight: 700; }
.rating-confirm-score span { color: #06a6b5; font-size: 24px; line-height: 1; }
.sale-error { margin: 5px 0 0; color: #a53d32; }
.sale-error:empty { display: none; }
.chat-safety-note { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 10px 20px; border-bottom: 1px solid #f1dfae; background: #fff6df; color: #6b4e08; font-size: 12px; line-height: 1.5; }
.chat-safety-note p { flex: 1; margin: 0; }
.chat-safety-error:not(:empty) { display: block; margin-top: 6px; color: #a53d32; }
.chat-safety-note button { position: relative; right: -7px; bottom: -7px; width: 28px; height: 28px; flex: 0 0 28px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #8a6410; font-size: 16px; line-height: 1; cursor: pointer; }
.chat-safety-note button:disabled { opacity: .6; cursor: wait; }
.chat-safety-note button:hover { background: #f7e9be; }
.chat-safety-note button:focus-visible { outline: 2px solid #8a6410; outline-offset: 2px; }
.delete-chat-button { width: 40px; min-height: 40px; flex: 0 0 auto; display: inline-grid; place-items: center; padding: 0; border: 1px solid #f0d7d9; border-radius: 8px; background: #fff8f8; color: #a53d48; cursor: pointer; }
.delete-chat-button svg { width: 19px; height: 19px; }
.delete-chat-button:hover { background: #ffeded; }
.delete-chat-button:focus-visible { outline: 3px solid #74d3da; outline-offset: 3px; }
.delete-chat-button:disabled { opacity: .6; cursor: wait; }
.chat-heading-actions { display: flex; flex: 0 0 auto; gap: 8px; }
.report-chat-button { padding: 8px 10px; border: 1px solid #f1dfae; border-radius: 8px; background: #fffaf0; color: #8a6410; font: 700 12px "DM Sans", sans-serif; cursor: pointer; }
.report-chat-button:hover { background: #fff3d6; }
.verify-note { margin: 0; padding: 16px 20px; border-top: 1px solid var(--line); background: #fff6df; color: #6b4e08; font-size: 13px; }
.verify-note a { color: var(--cyan-dark); font-weight: 700; }
.closed-chat-note { margin: 0; padding: 16px 20px; border-top: 1px solid var(--line); background: #e8fbfc; color: #14565d; font-size: 13px; line-height: 1.5; }
.retention-note { margin: 14px 8px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.message-list { flex: 1; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding: 20px; }
.message-area { position: relative; display: flex; flex: 1; min-height: 240px; }
.message-area .message-list { min-width: 0; }
.message-list[aria-busy="true"] { visibility: hidden; }
.chat-loading { display: grid; flex: 1; min-height: 240px; place-items: center; padding: 24px; }
.chat-panel > .chat-loading { position: absolute; inset: 0; z-index: 3; }
.chat-spinner { width: 36px; height: 36px; border: 3px solid #d5eeee; border-top-color: var(--cyan-dark); border-radius: 50%; animation: chat-spin .8s linear infinite; }
@keyframes chat-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .chat-spinner { animation: none; } }
.message-date { align-self: center; margin: 4px 0; color: var(--muted); font-size: 11px; font-weight: 700; }
.message-entry { width: fit-content; max-width: min(78%, 520px); }
.message-entry.is-mine { align-self: flex-end; }
.message-sender { display: block; margin: 0 10px 4px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.message { width: fit-content; max-width: 100%; padding: 10px 12px; border-radius: 13px 13px 13px 3px; background: #f1f7f7; overflow-wrap: anywhere; }
.message.is-mine { border-radius: 13px 13px 3px 13px; background: #dff8fa; }
.message p { margin: 0; font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.message-meta { display: flex; align-items: baseline; gap: 12px; margin-top: 5px; color: var(--muted); font-size: 10px; }
.message-time { flex: 0 0 auto; }
.message-delivery { min-width: 0; margin-left: auto; color: var(--cyan-dark); font-weight: 700; text-align: right; }
.deleted-message { color: #71868b; font-style: italic; }
.delete-message-button { padding: 2px 3px; border: 0; background: transparent; color: #a53d48; font: inherit; font-weight: 700; cursor: pointer; }
.delete-message-button:disabled { opacity: .6; cursor: wait; }
.message-photo-button { display: block; max-width: 100%; padding: 0; border: 0; border-radius: 8px; background: transparent; cursor: zoom-in; }
.message-photo-button:focus-visible { outline: 3px solid #078b9a; outline-offset: 3px; }
.photo-dialog { width: min(94vw, 1100px); max-width: none; max-height: 94vh; padding: 14px; border: 0; border-radius: 14px; background: #14343c; color: white; text-align: right; }
.photo-dialog::backdrop { background: rgba(8, 24, 28, .82); }
.photo-dialog img { display: block; max-width: 100%; max-height: calc(94vh - 75px); margin: 8px auto 0; object-fit: contain; }
.photo-dialog-close { padding: 8px 12px; border: 1px solid #91c6c9; border-radius: 8px; background: transparent; color: white; font: 700 13px "DM Sans", sans-serif; cursor: pointer; }
.message-suggestions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px 0; border-top: 1px solid var(--line); }
.message-suggestion { min-height: 36px; padding: 7px 12px; border: 1px solid #b9ecef; border-radius: 999px; background: #e8fbfc; color: var(--cyan-dark); font: 700 12px "DM Sans", sans-serif; cursor: pointer; }
.message-suggestion:hover:not(:disabled) { background: #d7f6f8; }
.message-suggestion:disabled { opacity: .6; cursor: not-allowed; }
.message-suggestion:focus-visible { outline: 3px solid #74d3da; outline-offset: 3px; }
.message-form { display: flex; flex-direction: column; gap: 9px; padding: 14px; border-top: 1px solid var(--line); }
.message-suggestions + .message-form { padding-top: 8px; border-top: 0; }
.composer-row { min-width: 0; display: flex; align-items: flex-end; gap: 8px; }
.message-form textarea { min-width: 0; height: 40px; min-height: 40px; flex: 1; resize: none; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; font: inherit; scrollbar-width: none; }
.message-form textarea::-webkit-scrollbar { display: none; }
.message-form textarea:focus { border-color: var(--cyan); outline: 2px solid #74d3da; outline-offset: 2px; }
.message-form button { min-height: 40px; padding: 8px 12px; border: 0; border-radius: 10px; background: var(--cyan); color: white; font: 700 13px "DM Sans", sans-serif; cursor: pointer; }
.message-form button:disabled { opacity: .6; cursor: not-allowed; }
.composer-tools { display: flex; flex: 0 0 auto; align-items: center; gap: 3px; }
.composer-tools button { width: 40px; min-height: 40px; display: grid; place-items: center; padding: 0; }
.composer-tools svg { width: 20px; height: 20px; }
.composer-tools button:focus-visible { outline: 3px solid #74d3da; outline-offset: 2px; }
.composer-tools button:hover:not(:disabled) { background: #d7f6f8; }
.composer-tools [aria-pressed="true"] { background: #fff0ef; color: #a53d32; }
.stop-icon, .composer-tools [aria-pressed="true"] .record-icon { display: none; }
.composer-tools [aria-pressed="true"] .stop-icon { display: block; }
.emoji-panel, .attachment-preview { width: 100%; display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.composer-tools button, .emoji-panel button, .attachment-preview button { background: #e8fbfc; color: var(--cyan-dark); }
.emoji-panel button { font-size: 20px; }
.attachment-preview img, .message-photo { display: block; max-width: min(100%, 300px); max-height: 250px; border-radius: 8px; object-fit: contain; }
.attachment-preview audio, .message-audio { max-width: 100%; }
.recording-status { margin: 0; color: #a53d32; font-size: 12px; font-weight: 700; }
.message-media-error { color: #a53d32; font-size: 12px; }
.empty-note { margin: auto; padding: 20px; color: var(--muted); font-size: 13px; text-align: center; line-height: 1.6; }
[hidden] { display: none !important; }
@media (max-width: 700px) {
  .topbar { height: 62px; padding: 0 16px; }
  .chat-page { width: calc(100% - 24px); margin-top: 20px; }
  .page-heading h1 { font-size: 25px; }
  .chat-layout { min-height: 0; grid-template-columns: 1fr; }
  .conversation-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .conversation-panel-inner { position: static; max-height: none; overflow-y: visible; }
  #conversation-list { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
  .chat-panel { min-height: 480px; }
  .chat-heading { padding: 16px; }
  .message-form { padding-right: 8px; padding-left: 8px; }
  .composer-row { gap: 5px; }
  .composer-tools { gap: 2px; }
  .composer-tools button { width: 34px; min-height: 40px; }
  .message-form textarea { padding-right: 6px; padding-left: 6px; }
  .composer-row > button { padding-right: 9px; padding-left: 9px; }
}
