/* The file is loaded after the app stylesheet both in the component and in its
   standalone document. Component selectors stay inside the chat shadow tree. */
/* Mobile WebKit recalculates rem units inside the shadow only when this host
   also follows the document's text size. Keep the approved font and weight. */
:host { font-size: 1rem; }
:host .thread-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
  margin-block: 8px 4px;
}
:host .thread-search .search { flex: 1 1 10rem; min-width: 0; }
:host .thread-search .primary { flex: 0 0 auto; }
:host .search-status:empty { display: none; }
:host .search-hits { list-style: none; margin: 0; padding: 0; }
:host .search-hits li + li { border-block-start: 1px solid var(--hair); }
:host .search-hit {
  width: 100%; min-height: 52px; display: grid; gap: 3px;
  text-align: start; padding: 8px 3px; overflow-wrap: anywhere;
}
:host .search-hit-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
:host .search-hit-meta strong { font-size: .88rem; }
:host .search-hit-meta time { margin-inline-start: auto; color: var(--mute); font-size: .75rem; }
:host .search-excerpt mark {
  border-radius: 2px; background: #cce9f4; color: #17384a; font-weight: 680;
}
:host .search-more { min-height: 44px; }
:host .search-more[hidden] { display: none; }

@media (prefers-color-scheme: dark) and (forced-colors: none) {
  /* Do not restyle a host application that has embedded the panel. */
  html:has(> body > hwl-chat), body:has(> hwl-chat) {
    color-scheme: dark; background: #111820; color: #edf2f6;
  }
  :host {
    color-scheme: dark;
    --base: #111820;
    --raised: #1b2630;
    --gray: #263541;
    --wash: #202d37;
    --ink: #edf2f6;
    --mute: #b5c1cc;
    --hair: #35434f;
    --blue: #abd6ed;
    --action: #216783;
    --action-wash: #203e50;
    --outline: #a5e0ff;
    --entry-muted: #b5c1cc;
    color: var(--ink); background: var(--base);
  }
  :host :is(.app, .rail, .composer, .top, .pagebody) { background: var(--base); }
  :host(:not([embedded])) .top.thread { background: var(--base); }
  :host :is(.sheet, .sheet-head) { background: var(--raised); color: var(--ink); }
  :host .sheet::backdrop { background: #070d1499; }
  :host .sheet { box-shadow: 0 -5px 26px #0006; }
  :host .dock {
    background: rgb(35 47 59 / 94%); border-color: #43535f;
    outline-color: #3d4c5a; box-shadow: 0 3px 14px #0005;
  }
  :host .dock button { color: #c0ced8; }
  :host .dock button[aria-current="page"],
  :host .primary, :host .choices button[aria-pressed="true"] {
    background: #335c7d; color: #fff; border-color: #7093ab;
  }
  :host .intro-card .section .primary { background: var(--action-wash); color: #b8e3f6; }
  :host .primary:disabled { color: #b8c3cc; background: #38444d; }
  :host .badge, :host .send-btn span, :host .jump-latest,
  :host .unread-filter[aria-pressed="true"], :host .reply-ready .reply-hint {
    background: var(--action); color: #fff;
  }
  :host .unread-filter, :host :is(.choices button, .minor, .response) { border-color: #6e808c; }
  :host .unread-filter[aria-pressed="true"], :host .jump-latest { border-color: #8bb8c9; }
  :host .send-btn:disabled span { color: #a2b3c0; background: #33414b; }
  :host :is(.search, .plus-btn span, .quote-sample, .reply-hint) { background: var(--wash); }
  :host .reply-hint { color: var(--blue); }
  :host .textframe, :host :is(.forminput, .field-label input:not([type="checkbox"]), .field-label select) {
    background: #19232c; border-color: #71828d; color: var(--ink);
  }
  :host .search input, :host .textframe textarea { color: var(--ink); }
  :host :is(input, textarea)::placeholder { opacity: 1; color: #a4b3c0; }
  :host .textframe:focus-within, :host .composer:focus-within .textframe { border-color: var(--outline); }
  :host :is(button, a, input, textarea, select):focus-visible,
  :host .bubble[role="button"]:focus-visible, :host .bubble-action:focus-visible { outline-color: var(--outline); }
  :host .focusmsg { outline-color: var(--outline); }
  :host .bubble, :host .incoming:hover { color: var(--ink); background: var(--gray); }
  :host .out .bubble, :host .out .bubble:hover { color: #fff; background: #335c7d; }
  :host .act { background: var(--raised); border-color: var(--hair); }
  :host .choices button:disabled { opacity: .82; }
  :host :is(.stamp, .name, .tiny, .receipt, .section h3, .subheading, .listrow > svg:last-child,
            .entry-auth p, .inbox-state p) { color: var(--mute); }
  :host .preview-author { color: #d1dde5; }
  :host .draft-author { color: #f4b493; }
  :host .thread-row[data-unread] .label-name { color: #f2f7fa; }
  :host .thread-row[data-unread] .when, :host .unread-divider { color: #a8d6ec; }
  :host .unread-divider::before, :host .unread-divider::after { border-color: #638697; }
  :host a { color: #abdafa; }
  :host .bubble a { color: inherit; }
  :host .avatar, :host .group-icon { color: #c7e4f1; background: #304856; }
  :host .av1 { color: #efcee6; background: #4c3549; }
  :host .av2, :host .group-icon.official-ops { color: #c8e4ce; background: #334c3c; }
  :host .av3 { color: #f0d8b6; background: #534330; }
  :host .av4, :host .group-icon.official-all { color: #ded8f5; background: #443f59; }
  :host .receipt .avatar { border-color: var(--base); }
  :host .status { color: #f6ddc8; background: #402f25; border-color: #735244; }
  :host :is(.warning, .errorbar) { color: #ffb5a9; }
  :host .pending-send { background: #1c303c; border-color: #85adbf; }
  :host .pending-state { color: #c7dce7; }
  :host .pending-send button { color: var(--blue); }
  :host .search-excerpt mark { background: #365d70; color: #f2f9fb; }
  /* Preserve the approved two-colour artwork on a contrast surface. */
  :host :is(.wordmark, .brandmini) {
    box-sizing: content-box; padding: 5px 8px; background: #edf3f6; border-radius: 8px;
  }
  :host .inbox-title img { background: #e4eef3; padding: 2px; border-radius: 6px; }
}
@media (min-width: 740px) and (prefers-color-scheme: dark) and (forced-colors: none) {
  :host(:not([embedded])) .app { background: #0d131a; }
  :host(:not([embedded])) .rail { background: var(--base); box-shadow: 0 0 0 1px var(--hair); }
}
