/* Shared inbox for staff, chefs and clients. Event-page chat has its own layout. */
#panel-messages {
  --msg-ink: #342220;
  --msg-muted: #705f56;
  --msg-line: #e3d9ce;
  --msg-paper: #fffdfa;
  --msg-accent: #542928;
  --msg-control: var(--admin-control-radius, 7px);
}
#panel-messages[hidden], #panel-messages [hidden] { display: none !important; }
#nc-msg-root {
  display: grid;
  grid-template-columns: clamp(16rem, 31%, 22rem) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: clamp(21rem, calc(100dvh - 11.5rem - var(--admin-hub-dock-clearance, 1rem)), 65rem);
  min-height: 0;
  color: var(--msg-ink);
  border: 1px solid var(--msg-line);
  border-radius: 12px;
  background: var(--msg-paper);
  box-shadow: 0 3px 14px #492b1810;
}
#nc-msg-root .nc-msg__list { min-width: 0; border-color: var(--msg-line); background: var(--msg-paper); }
#nc-msg-root .nc-msg__list-head { min-height: 3.8rem; padding: .8rem 1rem .4rem; border: 0; }
#nc-msg-list-title {
  display: flex; align-items: baseline; gap: .45rem;
  margin: 0; font: 650 1.32rem/1.2 var(--font-serif, Georgia, serif);
}
#nc-msg-list-count { color: var(--msg-muted); font: 500 .82rem/1.2 var(--font-sans, system-ui); font-variant-numeric: tabular-nums; }
#nc-msg-root .nc-msg__list-search { padding: .5rem 1rem .7rem; border: 0; background: transparent; }
#nc-msg-search { box-sizing: border-box; min-height: 2.4rem; border: 1px solid #cfc2b7; color: var(--msg-ink); background: #fff; font: inherit; font-size: .86rem; }
#nc-msg-root .nc-msg__audit-toggle { padding: .45rem 1rem .7rem; color: var(--msg-muted); border: 0; background: transparent; }
#nc-msg-root .nc-msg__audit-toggle__label { font-size: .78rem; letter-spacing: 0; }
#nc-msg-audit-toggle-input:checked + .nc-msg__audit-toggle__track { background: var(--msg-accent); }
#nc-msg-list-scroll { border-top: 1px solid var(--msg-line); overscroll-behavior: contain; }
#nc-msg-list-scroll .nc-msg__thread { box-sizing: border-box; padding: .8rem 1rem; border-color: #ebe3da; color: var(--msg-ink); }
#nc-msg-list-scroll .nc-msg__thread:hover { background: #f6f1ea; }
#nc-msg-list-scroll .nc-msg__thread.is-active { background: #f1e8df; box-shadow: inset 3px 0 0 var(--msg-accent); }
#nc-msg-list-scroll .nc-msg__thread-name { max-width: none; min-width: 0; font-size: .9rem; letter-spacing: -.01em; line-height: 1.4; }
#nc-msg-list-scroll .nc-msg__thread-name > span:not(.nc-msg__unread-dot) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#nc-msg-list-scroll .nc-msg__thread-topic { display: block; margin: .14rem 0 0; color: #57443c; font-size: .79rem; line-height: 1.4; }
#nc-msg-list-scroll .nc-msg__thread-preview { display: block; margin-top: .14rem; color: var(--msg-muted); line-height: 1.4; font-size: .79rem; }
#nc-msg-list-scroll .nc-msg__thread-time { font-size: .72rem; color: var(--msg-muted); }
#nc-msg-list-scroll .nc-msg__thread.is-unread .nc-msg__thread-time { color: #743f31; }
#nc-msg-list-scroll .nc-msg__unread-dot { width: .42rem; height: .42rem; background: #8a4c39; }
#nc-msg-list-scroll .nc-msg__role-tag { margin-inline-start: auto; letter-spacing: .015em; text-transform: none; border-radius: 4px; font-size: .67rem; background: #eee8df; color: #665143; }
#nc-msg-root .nc-msg__chat { min-width: 0; background: #fcf9f4; }
#nc-msg-root .nc-msg__chat-head {
  flex-direction: row; align-items: center; justify-content: space-between;
  padding: .85rem clamp(.85rem, 2vw, 1.5rem); min-height: 4rem;
  background: var(--msg-paper); border-color: var(--msg-line);
}
#nc-msg-thread-name { font: 650 clamp(1.02rem, 1.65vw, 1.3rem)/1.3 var(--font-serif, Georgia, serif); overflow-wrap: anywhere; }
#nc-msg-thread-sub { line-height: 1.4; color: var(--msg-muted); font-size: .77rem; }
#nc-msg-thread-event { background: transparent; white-space: normal; text-align: start; color: #783f32; padding: .2rem 0; font-size: .77rem; }
#nc-msg-chat-head-actions { position: relative; width: auto; display: block; padding: 0; }
#nc-msg-chat-head-actions summary, #nc-msg-root .nc-msg__back {
  align-items: center; justify-content: center; width: 2.45rem; min-height: 2.45rem;
  padding: 0; color: var(--msg-ink); background: #fff; border: 1px solid var(--msg-line);
  border-radius: var(--msg-control); cursor: pointer;
}
#nc-msg-chat-head-actions summary { display: flex; list-style: none; }
#nc-msg-chat-head-actions summary::-webkit-details-marker { display: none; }
#nc-msg-chat-head-actions .nc-msg__actions-list {
  display: grid; position: absolute; z-index: 10; right: 0; top: calc(100% + .3rem);
  width: max-content; max-width: 70vw; padding: .28rem; background: white;
  border: 1px solid var(--msg-line); border-radius: 8px; box-shadow: 0 5px 20px #48291c20;
}
#nc-msg-chat-head-actions:not([open]) .nc-msg__actions-list { display: none; }
#nc-msg-chat-head-actions .nc-msg__resend-notify { padding: .55rem .75rem; border: none; background: transparent; text-align: start; text-transform: none; font-size: .82rem; letter-spacing: 0; }
#nc-msg-chat-head-actions .nc-msg__resend-notify:hover { background: #f6f1ec; }
#nc-msg-root .nc-msg__empty-pane { padding: 2rem 1rem; background: #fcf9f4; }
#nc-msg-root .nc-msg__empty-pane h3 { color: var(--msg-ink); margin: 0 0 .4rem; font: 600 1.35rem var(--font-serif, Georgia, serif); }
#nc-msg-root .nc-msg__empty-pane p { margin: 0; color: var(--msg-muted); font-size: .88rem; }
#nc-msg-chat-scroll {
  background: #fbf8f3; overscroll-behavior: contain; padding: 1.2rem clamp(.9rem, 2.5vw, 2rem);
  scrollbar-gutter: stable; overflow-x: hidden;
}
#nc-msg-chat-scroll .nc-msg__day-wrap { display: flex; align-items: center; gap: .75rem; margin: .55rem 0 1.15rem; }
#nc-msg-chat-scroll .nc-msg__day-wrap::before, #nc-msg-chat-scroll .nc-msg__day-wrap::after { content: ""; flex: 1; border-top: 1px solid var(--msg-line); }
#nc-msg-chat-scroll .nc-msg__day { background: transparent; box-shadow: none; padding: 0; color: var(--msg-muted); font-size: .73rem; }
#nc-msg-chat-scroll .nc-msg__bubble-wrap { max-width: min(85%, 41rem); min-width: 0; }
#nc-msg-chat-scroll .nc-msg__sender-label { margin-bottom: .35rem; color: var(--msg-muted); }
#nc-msg-chat-scroll .nc-msg__bubble {
  box-sizing: border-box; max-width: 100%; padding: .65rem .85rem; border: 1px solid #dfd4c8;
  border-radius: 10px 10px 10px 3px; box-shadow: none; background: #fff; color: var(--msg-ink);
  font-size: .91rem; line-height: 1.5; overflow-wrap: anywhere;
}
#nc-msg-chat-scroll .is-mine .nc-msg__bubble { border-color: #dfcec1; border-radius: 10px 10px 3px 10px; background: #eee2d6; }
#nc-msg-chat-scroll .nc-msg__bubble-meta { float: none; display: flex; justify-content: flex-end; margin: .3rem 0 0; font-size: .68rem; color: #715e53; }
#nc-msg-chat-scroll .nc-msg__check.is-read { color: #655046; }
#nc-msg-chat-scroll .nc-msg__att { max-width: 100%; }
#nc-msg-root .nc-msg__history-status, #nc-msg-root .nc-msg__list-loading, #nc-msg-root .nc-msg__list-empty {
  color: var(--msg-muted); font-size: .86rem; padding: 1rem; text-align: center;
}
#panel-messages #msg-err:not([hidden]) { padding: .55rem .8rem; margin: 0 0 .5rem; background: #fff1eb; border-left: 3px solid #9d493a; }
#nc-msg-root .nc-msg__newbtn, #nc-msg-root .nc-msg__send, #nc-newthread .nc-create {
  border-radius: var(--admin-control-radius, 7px); min-height: 2.25rem; background: #542928; color: #fff; font-weight: 650;
}
#nc-msg-root .nc-msg__newbtn { font-size: .79rem; padding: .4rem .7rem; }
#nc-msg-root .nc-msg__send:disabled, #nc-newthread .nc-create:disabled { background: #e4dbd3; color: #705e56; cursor: default; }
#nc-msg-root .nc-msg__compose { position: static; padding: .65rem .85rem; background: var(--msg-paper); box-shadow: none; border-color: var(--msg-line); }
#nc-msg-root .nc-msg__compose textarea { min-width: 0; min-height: 2.6rem; border-radius: var(--msg-control); border-color: #cebfaf; }
#nc-msg-root .nc-msg__readonly { margin: 0; padding: .85rem 1.1rem; color: #66554b; font-size: .81rem; border-top: 1px solid var(--msg-line); background: var(--msg-paper); }
#nc-msg-root .nc-msg__concierge-banner { background: #f4ede4; border-color: var(--msg-line); }
dialog#nc-newthread {
  inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  box-sizing: border-box; margin: 0; border: 0; background: transparent;
}
dialog#nc-newthread:not([open]) { display: none; }
dialog#nc-newthread::backdrop { background: rgb(40 24 20 / .36); }
#nc-newthread .nc-newthread__box { max-height: calc(100dvh - 2rem); overflow-y: auto; background: #fffdfa; }
#nc-newthread .nc-newthread__actions button { text-transform: none; letter-spacing: 0; min-height: 2.35rem; }
#nc-newthread .nc-newthread__recipient {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .1rem .75rem;
  align-items: baseline;
  margin: 0 0 .75rem;
  padding: .65rem .8rem;
  background: #f6efe8;
  border-radius: .4rem;
  color: #442821;
  overflow-wrap: anywhere;
}
#nc-newthread .nc-newthread__recipient span { color: #705950; font-size: .85rem; }
#nc-newthread .nc-newthread__recipient span:last-child { grid-column: 2; }
#panel-messages :is(button, input, textarea, summary, [tabindex]):focus-visible,
#nc-newthread :is(button, input, select, textarea):focus-visible { outline: 2px solid #994f3a; outline-offset: 2px; }
#nc-msg-list-scroll .nc-msg__thread:focus-visible, #nc-msg-chat-scroll:focus-visible { outline-offset: -3px; }
@media (max-width: 760px) {
  #nc-msg-root {
    display: grid; flex: none; grid-template-columns: minmax(0,1fr);
    height: max(18rem, calc(100dvh - 9.65rem - var(--admin-hub-dock-clearance, 1rem)));
    border-radius: 10px;
  }
  #nc-msg-root .nc-msg__chat-head { padding: .6rem .75rem; }
  #nc-msg-root .nc-msg__chat-head-id { width: auto; }
  #nc-msg-root .nc-msg__concierge-banner { padding: .45rem .75rem; }
  #nc-msg-root .nc-msg__back, #nc-msg-root .nc-msg__newbtn, #nc-msg-chat-head-actions summary { min-height: 2.75rem; }
  #nc-msg-root .nc-msg__back, #nc-msg-chat-head-actions summary { width: 2.75rem; }
  #nc-msg-chat-scroll { padding: .85rem .7rem; }
  #nc-msg-chat-scroll .nc-msg__bubble-wrap { max-width: 92%; }
  #nc-msg-root .nc-msg__compose textarea { font-size: 1rem; }
  #nc-newthread .nc-newthread__row { grid-template-columns: 1fr; }
}
