/* CrownOS message kit: files on messages (thumbnails, PDF buttons, files waiting to be sent, the photo viewer).
   Shared by the console, the station screen, the dealer portal and CrownOS Home; it borrows each page's colours
   where they exist and has its own otherwise. */
.mk-files { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 2px; }
.mk-photo { position: relative; width: 112px; height: 112px; padding: 0; overflow: hidden; border: 1px solid var(--line, #d9d5cc); border-radius: 8px;
  background: var(--paper, #f4f2ee); cursor: zoom-in; }
.mk-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mk-photo img:not([src]) { visibility: hidden; }
.mk-photo.mk-missing::after { content: 'Unavailable'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; color: var(--muted, #6b675f); }
.mk-file { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 44px; padding: 6px 12px 6px 6px; border: 1px solid var(--line, #d9d5cc);
  border-radius: 8px; background: var(--white, #fff); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.mk-file .mk-kind { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; background: var(--red-tint, #fbe9e7);
  color: var(--red, #b3261e); font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.mk-file .mk-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.mk-file small, .mk-pending small { color: var(--muted, #6b675f); }
.mk-photo:focus-visible, .mk-file:focus-visible, .mk-pick:focus-visible, .mk-remove:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.mk-input[hidden] { display: none; }
.mk-pending { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.mk-pending[hidden] { display: none; }
.mk-pending li { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 4px 4px 10px; border: 1px solid var(--line, #d9d5cc);
  border-radius: 999px; background: var(--paper, #f4f2ee); font-size: 13px; }
.mk-pending .mk-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.mk-remove { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.mk-remove:hover { background: rgba(0, 0, 0, .08); }

.mk-viewer { width: min(96vw, 1400px); max-width: none; height: min(94vh, 1000px); max-height: none; padding: 0; border: 0; border-radius: 10px;
  background: #111; color: #fff; }
.mk-viewer::backdrop { background: rgba(0, 0, 0, .7); }
.mk-viewer[open] { display: flex; flex-direction: column; }
.mk-viewer-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; font-size: 14px; }
.mk-viewer-bar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-viewer-bar a, .mk-viewer-bar button { min-height: 36px; padding: 6px 14px; border: 1px solid rgba(255, 255, 255, .4); border-radius: 6px; background: transparent;
  color: #fff; font: inherit; text-decoration: none; cursor: pointer; }
.mk-viewer img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }

@media (max-width: 600px) {
  .mk-photo { width: 88px; height: 88px; }
  .mk-file .mk-name, .mk-pending .mk-name { max-width: 150px; }
  .mk-viewer { width: 100vw; height: 100vh; border-radius: 0; }
}
.mk-pick { white-space: nowrap; }

/* Replies, reactions and pins: they take the page's colours, and work on the station screen's dark theme too. */
.mk-quote { display: flex; flex-direction: column; gap: 1px; width: 100%; max-width: 560px; margin: 4px 0 6px; padding: 4px 10px; border: 0;
  border-left: 3px solid var(--crn-accent, #2f5d3a); border-radius: 0 6px 6px 0; background: color-mix(in srgb, currentColor 6%, transparent);
  color: inherit; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.mk-quote strong { font-size: 12px; font-weight: 600; }
.mk-quote span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; opacity: .8; overflow-wrap: anywhere; }
.mk-quote:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.mk-replying { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; padding: 4px 4px 4px 10px; border-left: 3px solid var(--crn-accent, #2f5d3a);
  border-radius: 0 6px 6px 0; background: color-mix(in srgb, currentColor 6%, transparent); font-size: 13px; }
.mk-replying[hidden] { display: none; }
.mk-replying-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-reacts { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 6px 0 0; }
.mk-react, .mk-react-add { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 2px 9px; border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  border-radius: 999px; background: transparent; color: inherit; font: inherit; font-size: 13px; line-height: 1; cursor: pointer; }
.mk-react.mine { border-color: var(--crn-accent, #2f5d3a); background: color-mix(in srgb, var(--crn-accent, #2f5d3a) 14%, transparent); font-weight: 600; }
.mk-react[disabled] { cursor: default; }
.mk-react-add { opacity: .7; }
.mk-react-add:hover, .mk-react-add[aria-expanded="true"] { opacity: 1; }
.mk-react-menu { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid color-mix(in srgb, currentColor 22%, transparent); border-radius: 999px;
  background: var(--crn-surface, var(--white, #fff)); box-shadow: 0 4px 14px rgba(0, 0, 0, .12); }
.mk-react-menu[hidden] { display: none; }
.mk-react-menu button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: transparent; font-size: 18px; cursor: pointer; }
.mk-react-menu button:hover, .mk-react-menu button[aria-pressed="true"] { background: color-mix(in srgb, currentColor 10%, transparent); }
.mk-pins { margin: 0 0 8px; border: 1px solid color-mix(in srgb, currentColor 16%, transparent); border-radius: 8px; font-size: 13px; }
.mk-pins summary { padding: 6px 10px; font-weight: 600; cursor: pointer; }
.mk-pins ul { display: grid; gap: 4px; margin: 0; padding: 0 8px 8px; list-style: none; }
.mk-pins li { display: flex; align-items: flex-start; gap: 6px; }
.mk-pins .mk-quote { margin: 0; }
.mk-pinned-flag { font-size: 12px; opacity: .75; }
.mk-flash { animation: mk-flash 1.8s ease-out; }
@keyframes mk-flash { 0%, 30% { background: color-mix(in srgb, var(--crn-accent, #2f5d3a) 18%, transparent); } 100% { background: transparent; } }
.mk-quote:focus-visible, .mk-react:focus-visible, .mk-react-add:focus-visible, .mk-react-menu button:focus-visible, .mk-pins summary:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .mk-flash { animation: none; outline: 2px solid var(--crn-accent, #2f5d3a); } }
@media (max-width: 600px) { .mk-react-menu button { width: 40px; height: 40px; } .mk-react, .mk-react-add { min-height: 34px; } }

/* Voice messages: the hold-to-talk button, the clip's player and Clark's words under it. */
.mk-mic { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px; border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  border-radius: 999px; background: transparent; color: inherit; font: inherit; font-size: 13px; white-space: nowrap; cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.mk-mic-icon { font-size: 16px; line-height: 1; }
.mk-mic.mk-recording { border-color: var(--red, #b3261e); background: var(--red, #b3261e); color: #fff; font-variant-numeric: tabular-nums; }
.mk-mic.mk-recording .mk-mic-icon { animation: mk-pulse 1s ease-in-out infinite; }
@keyframes mk-pulse { 50% { opacity: .35; } }
.mk-mic:focus-visible, .mk-play:focus-visible, .mk-said-retry:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.mk-pending-voice { border-color: var(--crn-accent, #2f5d3a); }
.mk-voice { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 360px; margin: 6px 0 0; padding: 6px 12px 6px 6px;
  border: 1px solid color-mix(in srgb, currentColor 16%, transparent); border-radius: 999px; background: color-mix(in srgb, currentColor 4%, transparent); }
.mk-play { flex: none; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  background: var(--crn-accent, #2f5d3a); color: #fff; font-size: 14px; cursor: pointer; }
.mk-play.mk-loading { opacity: .6; cursor: progress; }
.mk-voice-bar { flex: 1; height: 4px; overflow: hidden; border-radius: 2px; background: color-mix(in srgb, currentColor 18%, transparent); }
.mk-voice-fill { display: block; width: 0; height: 100%; background: var(--crn-accent, #2f5d3a); }
.mk-voice-time { flex: none; min-width: 34px; font-size: 12px; font-variant-numeric: tabular-nums; opacity: .8; }
.mk-said { max-width: 560px; margin: 4px 0 0; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.mk-said-by { display: inline-block; margin-right: 4px; padding: 0 6px; border-radius: 4px; background: color-mix(in srgb, var(--crn-accent, #2f5d3a) 14%, transparent);
  font-size: 11px; font-weight: 600; letter-spacing: .02em; vertical-align: 1px; }
.mk-said-note { font-size: 13px; opacity: .7; }
.mk-said-retry { min-height: 28px; padding: 2px 8px; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .mk-mic.mk-recording .mk-mic-icon { animation: none; } }
@media (max-width: 600px) { .mk-mic { min-height: 44px; padding: 6px 14px; } .mk-play { width: 42px; height: 42px; } }
