:root {
  --mk-navy: #24324a;
  --mk-blue: #4056a1;
  --mk-coral: #f47b6a;
  --mk-canvas: #f4f6fb;
  --mk-inbound: #ffffff;
  --mk-outbound: #dfe7ff;
}

html, body { height: 100%; }
body { color: var(--mk-navy); }
.app-page { margin: 0; overflow: hidden; background: var(--mk-canvas); }
.app-header { height: 64px; background: #fff; border-bottom: 3px solid var(--mk-coral); }
.brand-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--mk-blue); color: #fff; font-weight: 800; letter-spacing: .04em; }
.brand-mark-sm { width: 38px; height: 38px; border-radius: 11px; }
.environment-label, .environment-ribbon { font-size: .68rem; font-weight: 800; letter-spacing: .12em; }
.environment-label.test, .environment-ribbon.test { color: #8a5a00; }
.environment-label.prod, .environment-ribbon.prod { color: #a82116; }
.chat-shell { display: grid; grid-template-columns: minmax(300px, 390px) 1fr; height: calc(100vh - 64px); }
.conversation-sidebar { min-width: 0; overflow-y: auto; background: #fff; border-right: 1px solid #dce1eb; }
.conversation-filters { position: sticky; top: 0; z-index: 2; background: #fff; }
.conversation-item { padding: .9rem 1rem; border-left: 4px solid transparent !important; }
.conversation-item.active { color: inherit; background: #eef1ff; border-left-color: var(--mk-coral) !important; }
.conversation-item time, .conversation-meta, .conversation-preview { color: #697386; font-size: .78rem; }
.conversation-preview { margin-top: .3rem; font-size: .86rem; }
.direction-icon { color: var(--mk-blue); font-weight: 700; }
.chat-pane { min-width: 0; min-height: 0; overflow: hidden; background: linear-gradient(135deg, #f7f8fc 0%, #edf1f8 100%); }
.conversation-view { display: grid; grid-template-rows: auto minmax(0, 1fr); width: 100%; height: 100%; min-width: 0; min-height: 0; }
.conversation-header { display: flex; align-items: center; gap: .75rem; width: 100%; min-width: 0; min-height: 62px; padding: .7rem 1rem; background: rgba(255,255,255,.96); }
.conversation-header-meta { color: #697386; font-size: .78rem; }
.min-w-0 { min-width: 0; }
.message-history { min-width: 0; min-height: 0; overflow-y: auto; padding: 1.5rem clamp(1rem, 4vw, 4rem); }
.message-row { display: flex; margin: .45rem 0; }
.message-row.outbound { justify-content: flex-end; }
.message-bubble { max-width: min(72%, 680px); padding: .65rem .8rem .45rem; border: 1px solid #dce1eb; border-radius: 15px 15px 15px 4px; background: var(--mk-inbound); box-shadow: 0 2px 5px rgba(36,50,74,.06); overflow-wrap: anywhere; }
.message-text { white-space: pre-wrap; }
.outbound .message-bubble { border-radius: 15px 15px 4px 15px; border-color: #c9d4fa; background: var(--mk-outbound); }
.message-bubble footer, .message-detail { margin-top: .35rem; color: #667085; font-size: .7rem; }
.message-placeholder { color: #697386; font-style: italic; }
.interactive-header, .interactive-section-title { margin-bottom: .35rem; font-weight: 700; }
.interactive-footer { margin-top: .35rem; color: #697386; font-size: .78rem; }
.interactive-details { margin-top: .45rem; }
.interactive-details summary { color: var(--mk-blue); cursor: pointer; font-size: .8rem; font-weight: 700; user-select: none; }
.interactive-details summary:focus-visible { border-radius: .25rem; outline: 3px solid rgba(64,86,161,.3); outline-offset: 2px; }
.interactive-details-content { padding-top: .1rem; }
.interactive-action, .interactive-option { margin-top: .45rem; padding: .45rem .65rem; border: 1px solid #aebce9; border-radius: .55rem; background: rgba(255,255,255,.55); color: var(--mk-blue); text-align: center; }
.interactive-option.selected { border-color: #198754; background: #e5f5ec; color: #146c43; }
.interactive-section, .interactive-card { margin-top: .55rem; padding: .55rem; border: 1px solid #c9d4fa; border-radius: .65rem; }
.list-option { display: grid; text-align: left; }
.list-option small { color: #697386; }
.option-id { display: block; color: #697386; font-family: monospace; font-size: .65rem; }
.media-attachment { margin-top: .5rem; }
.media-image-link { display: block; width: fit-content; max-width: 100%; cursor: zoom-in; }
.media-image-link:focus-visible { border-radius: .65rem; outline: 3px solid rgba(64,86,161,.3); outline-offset: 2px; }
.media-attachment img, .media-attachment video { display: block; width: min(100%, 340px); max-height: 320px; border-radius: .65rem; object-fit: contain; }
.media-attachment audio { display: block; width: min(100%, 420px); }
.media-caption { margin-top: .3rem; font-size: .82rem; white-space: pre-wrap; }
.system-event { width: fit-content; margin: .7rem auto; padding: .25rem .65rem; border-radius: 1rem; background: #e1e5ed; color: #5e6878; font-size: .72rem; }
.empty-chat { display: grid; place-content: center; height: 100%; text-align: center; }
.empty-chat-icon { color: var(--mk-blue); font-size: 2rem; }
.login-page { display: grid; place-items: center; min-height: 100%; padding: 1rem; background: linear-gradient(140deg, #e9edff, #fff2ef); }
.login-card { position: relative; width: min(100%, 440px); overflow: hidden; border: 0; }
.environment-ribbon { position: absolute; top: 18px; right: -34px; width: 130px; padding: .25rem; transform: rotate(40deg); background: #fff2cf; text-align: center; }
.btn-primary { --bs-btn-bg: var(--mk-blue); --bs-btn-border-color: var(--mk-blue); --bs-btn-hover-bg: #33478e; }

@media (max-width: 767.98px) {
  .chat-shell { display: block; }
  .conversation-sidebar, .chat-pane { height: 100%; }
  .chat-pane:empty { display: none; }
  .mobile-hidden { display: none; }
  .message-bubble { max-width: 88%; }
}
