/*
 * Important Messages: the bell in the top bar, the message popup, the
 * composer's rich editor and the All messages page.
 *
 * Loaded on every page right after form_roles.css, so on equal specificity
 * these rules win over base.css. Colors come from base.css and Bootstrap
 * tokens only. This file declares a few tokens of its own:
 *   - --tpg-notify-unread: the bell's unread dot (gold in dark, --tpg-700
 *     in light).
 *   - Eight editor tokens beside the .prose-editor token block in base.css:
 *     --tpg-prose-editor-success-color, --tpg-prose-editor-danger-color,
 *     --tpg-prose-editor-hover-bg, --tpg-prose-editor-pressed-bg,
 *     --tpg-prose-editor-control-border-color,
 *     --tpg-prose-editor-control-hover-border-color,
 *     --tpg-prose-editor-field-bg and --tpg-prose-editor-pop-shadow.
 * It also adds two modifiers for the shared .tpg-inline-pill:
 * .tpg-inline-pill--sm (compact size) and .tpg-inline-pill[data-tone="muted"]
 * (a state that is off or over). Some rules set existing variables locally
 * (--dropdown-blur, --tpg-record-row-border-color, Bootstrap's --bs-*
 * component variables). Light-theme overrides use [data-bs-theme="light"];
 * dark is the default.
 */

/* ---- Bell in the top bar -------------------------------------------- */

/* The bell and the profile photo share one row at every width
   (Bootstrap stacks .navbar-nav items under 992px). */
.page-top-nav .navbar-nav.btn-group {
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
}

.tpg-notify-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  margin-right: 0.6rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--nav-sidebar-link-active);
  font-size: 1.15rem;
  transition: background-color var(--tpg-motion-duration-fast) var(--tpg-motion-ease-standard);
}

.tpg-notify-bell:hover,
.tpg-notify-bell[aria-expanded="true"] {
  background: rgba(var(--bs-emphasis-color-rgb), 0.08);
}

.tpg-notify-bell:focus-visible {
  outline: 0;
  box-shadow: var(--tpg-focus-ring);
}

.tpg-notify-bell__badge {
  position: absolute;
  top: 0.1rem;
  right: 0;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--nav-background);
  color: var(--tpg-1000);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
}

.tpg-notify-bell__badge[hidden] {
  display: none;
}

/* ---- Bell panel (a .dropdown-menu, so it inherits the menu surface) -- */

/* The bell's unread dot: gold in dark, --tpg-700 in light. */
:root {
  --tpg-notify-unread: var(--gold);
}

[data-bs-theme="light"] {
  --tpg-notify-unread: var(--tpg-700);
}

.tpg-notify-panel {
  /* Same glass surface as every dropdown, blurred harder so the page
     behind never shows through a list of message text. */
  --dropdown-blur: 18px;
  width: min(25rem, calc(100vw - 1.5rem));
  margin-top: 0.4rem !important;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--tpg-card-panel-border-color);
  border-radius: var(--bs-border-radius-lg);
  font-size: 0.875rem;
}

.tpg-notify-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem 0.7rem;
  border-bottom: 1px solid var(--tpg-card-panel-header-border);
}

/* Mark all as read: a link-style button flush with the panel edge. */
.tpg-notify-panel__action {
  padding: 0;
}

.tpg-notify-panel__list {
  max-height: min(27rem, calc(100vh - 12rem));
  max-height: min(27rem, calc(100dvh - 12rem));
  margin: 0;
  padding: 0.35rem;
  overflow-y: auto;
  list-style: none;
}

.tpg-notify-panel__footer {
  padding: 0.65rem;
  border-top: 1px solid var(--tpg-card-panel-header-border);
}

.tpg-notify-item {
  display: grid;
  grid-template-columns: 0.5rem minmax(0, 1fr) auto;
  align-items: start;
  gap: 0 0.7rem;
  width: 100%;
  padding: 0.7rem 0.65rem;
  border: 0;
  border-radius: var(--bs-border-radius);
  background: transparent;
  color: var(--bs-body-color);
  text-align: left;
}

.tpg-notify-item:hover {
  background: rgba(var(--bs-emphasis-color-rgb), 0.05);
}

.tpg-notify-item:focus-visible {
  outline: 0;
  box-shadow: var(--tpg-focus-ring);
}

.tpg-notify-item__dot {
  width: 0.5rem;
  height: 0.5rem;
  margin-top: 0.38rem;
  border-radius: 50%;
}

.tpg-notify-item.is-unread .tpg-notify-item__dot {
  background: var(--tpg-notify-unread);
}

.tpg-notify-item__title {
  display: block;
  color: var(--bs-emphasis-color);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.3;
}

.tpg-notify-item.is-unread .tpg-notify-item__title {
  font-weight: 700;
}

.tpg-notify-item__snippet {
  display: -webkit-box;
  margin-top: 0.15rem;
  overflow: hidden;
  color: var(--bs-secondary-color);
  font-size: 0.8rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tpg-notify-item__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  margin-top: 0.4rem;
  color: var(--bs-secondary-color);
  font-size: 0.74rem;
}

.tpg-notify-item__thumb {
  width: 3rem;
  height: 3rem;
  border-radius: 0.5rem;
  object-fit: cover;
}

.tpg-notify-empty {
  padding: 2rem 1rem;
  color: var(--bs-secondary-color);
  text-align: center;
}

/* ---- Additions to the shared .tpg-inline-pill (base.css) --------------- */

/* Office and popup tags in the bell, the popup and All messages are the
   shared .tpg-inline-pill. --sm is a compact size for rows and meta lines. */
.tpg-inline-pill--sm {
  gap: 0.3rem;
  padding: 0.1rem 0.5rem;
  font-size: 0.72rem;
  line-height: 1.35;
}

.tpg-inline-pill--sm i {
  font-size: 0.7rem;
}

/* Muted tone: a state that is off or over (No popup, Popup ended). */
.tpg-inline-pill[data-tone="muted"] {
  border-style: dashed;
  background: transparent;
  color: var(--bs-secondary-color);
}

/* base.css tints light pills after the tone rules; muted stays clear. */
[data-bs-theme="light"] .tpg-inline-pill[data-tone="muted"] {
  background: transparent;
}

/* ---- Popup (Bootstrap modal + .card.tpg-card-panel) ------------------ */

.tpg-announcement-modal {
  --bs-modal-width: 41rem;
}

/* The shared panel gradient is see-through in light mode, so the popup gets
   a solid base and the page never shows through. Dark uses --dark-200. */
[data-bs-theme="light"] .tpg-announcement-modal .modal-content {
  background-color: var(--bs-body-bg);
}

.tpg-announcement-modal .modal-header {
  gap: 1rem;
  padding: 1.35rem 1.5rem 1.1rem;
}

.tpg-announcement-modal__eyebrow {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.6rem;
  text-transform: uppercase;
}

.tpg-announcement-modal__eyebrow i {
  color: var(--gold);
}

[data-bs-theme="light"] .tpg-announcement-modal__eyebrow i {
  color: var(--tpg-700);
}

.tpg-announcement-modal__title {
  margin: 0;
  color: var(--bs-heading-color);
  font-size: clamp(1.65rem, 1.35rem + 1vw, 2.15rem);
  line-height: 1.1;
}

/* Text styles come from utilities: small text-body-secondary fw-normal mb-0.
   The space under the title comes from base.css (.card-header .text-body-secondary). */
.tpg-announcement-modal__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
}

.tpg-announcement-modal .modal-body {
  padding: 1.35rem 1.5rem 1.5rem;
}

.tpg-announcement-modal .modal-footer {
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.5rem;
  border-top: 1px solid var(--tpg-card-panel-header-border);
}

.tpg-announcement-modal .modal-footer > * {
  margin: 0;
}

.tpg-announcement-modal__pager {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.tpg-announcement-modal__dots {
  display: inline-flex;
  gap: 0.35rem;
}

.tpg-announcement-modal__dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--tpg-card-panel-header-border);
  box-shadow: inset 0 0 0 1px rgba(var(--bs-emphasis-color-rgb), 0.25);
}

.tpg-announcement-modal__dot.is-current {
  background: var(--gold);
  box-shadow: none;
}

[data-bs-theme="light"] .tpg-announcement-modal__dot.is-current {
  background: var(--tpg-700);
}

/* Authored message HTML: .tpg-prose owns the type; these add figures. */
.tpg-prose figure {
  margin: 0 0 1rem;
}

.tpg-prose figure img {
  display: block;
  width: 100%;
}

.tpg-prose figcaption {
  margin-top: 0.45rem;
  color: var(--bs-secondary-color);
  font-size: 0.82rem;
  text-align: center;
}

.tpg-prose a {
  color: var(--bs-link-color);
}

.tpg-prose a:hover {
  color: var(--bs-link-hover-color);
}

/* ---- Rich editor (mirrors the .prose-editor theme already in base.css) */

/* Editor tokens that extend the .prose-editor token block in base.css. The
   editor paper stays light in both themes, so tints and edges on it are
   fixed rather than flipped with the theme. */
.prose-editor,
.prose-editor-dialog {
  /* Status text on the paper. The shared status tokens turn light for dark
     surfaces in the dark theme, so they are darkened back here to stay
     readable on the light paper; the light theme uses them as they are. */
  --tpg-prose-editor-success-color: color-mix(in srgb, var(--tpg-success) 42%, var(--tpg-1000));
  --tpg-prose-editor-danger-color: color-mix(in srgb, var(--tpg-danger) 60%, var(--tpg-1000));
  /* Tints and edges: --tpg-1000 at about 0.68x the alpha the warm grey of
     --prose-editor-border-color would use, so over the light paper they
     land on the same shades as that grey. */
  --tpg-prose-editor-hover-bg: rgba(var(--tpg-1000-rgb), 0.08);
  --tpg-prose-editor-pressed-bg: rgba(var(--gold-rgb), 0.42);
  --tpg-prose-editor-control-border-color: rgba(var(--tpg-1000-rgb), 0.24);
  --tpg-prose-editor-control-hover-border-color: rgba(var(--tpg-1000-rgb), 0.31);
  /* Fields sit a step brighter than the paper. */
  --tpg-prose-editor-field-bg: var(--bs-white);
  /* Floating panels lift off the paper with a soft shadow. */
  --tpg-prose-editor-pop-shadow: 0 18px 30px rgba(var(--tpg-1000-rgb), 0.18);
}

[data-bs-theme="light"] .prose-editor,
[data-bs-theme="light"] .prose-editor-dialog {
  --tpg-prose-editor-success-color: var(--tpg-success);
  --tpg-prose-editor-danger-color: var(--tpg-danger);
}

.tpg-rich-editor {
  position: relative;
  border: 1px solid var(--prose-editor-border-color);
  border-radius: var(--bs-border-radius);
  background: var(--prose-editor-background);
  color: var(--prose-editor-foreground);
}

.tpg-rich-editor:focus-within {
  border-color: var(--tpg-400);
  box-shadow: var(--tpg-focus-ring);
}

.tpg-rich-editor.is-invalid {
  border-color: var(--tpg-danger);
}

/* The toolbar stays in view while you scroll through a long message (the
   composer card clips with overflow: clip, so sticky works). Below 992px the
   app's top bar is sticky only for the first screen of a page (html and body
   are height: 100% in base.css), so the toolbar sits under it, and the
   composer script moves it up as the bar scrolls away. */
.tpg-rich-editor__toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--prose-editor-border-color);
  border-radius: var(--bs-border-radius) var(--bs-border-radius) 0 0;
  background: var(--light-200);
}

/* Same breakpoint as the sticky top bar in base.css. */
@media (max-width: 991px) {
  .tpg-rich-editor__toolbar {
    top: var(--tpg-mobile-top-nav-height);
  }
}

.tpg-rich-editor__group {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding-right: 0.4rem;
  border-right: 1px solid var(--prose-editor-typographic);
}

.tpg-rich-editor__group:last-child {
  border-right: 0;
}

.tpg-rich-editor__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.45rem;
  border: 0;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--prose-editor-foreground);
  font-size: 0.85rem;
  font-weight: 500;
}

.tpg-rich-editor__btn:hover {
  background: var(--tpg-prose-editor-hover-bg);
}

.tpg-rich-editor__btn:focus-visible {
  outline: 0;
  box-shadow: var(--tpg-focus-ring);
}

.tpg-rich-editor__btn[aria-pressed="true"],
.tpg-rich-editor__btn[aria-expanded="true"] {
  background: var(--tpg-prose-editor-pressed-bg);
  color: var(--tpg-900);
  /* A 3:1 edge, so Bold, lists and open menus read as on without relying
     on the light tint. It comes after :focus-visible, so it stays with the
     focus ring. */
  outline: 1px solid var(--tpg-700);
  outline-offset: -1px;
}

.tpg-rich-editor__btn--style {
  min-width: 9.5rem;
  justify-content: space-between;
  border: 1px solid var(--prose-editor-border-color);
  background: var(--prose-editor-background);
}

.tpg-rich-editor__btn--style i {
  font-size: 0.7rem;
  opacity: 0.7;
}

.tpg-rich-editor__surface.ProseMirror {
  min-height: 19rem !important;
  max-height: 34rem;
  overflow-y: auto;
  border: 0;
  outline: 0;
}

.tpg-rich-editor__surface figure {
  margin: 0 0 1rem;
}

.tpg-rich-editor__surface figcaption {
  margin-top: 0.45rem;
  color: var(--tpg-prose-editor-muted-color);
  font-size: 0.82rem;
  text-align: center;
}

.tpg-rich-editor__surface img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  cursor: pointer;
}

/* Click a picture to describe, mark or remove it. */
.tpg-rich-editor__surface img:hover,
.tpg-rich-editor__surface img[data-editing] {
  outline: 2px solid rgba(var(--gold-rgb), 0.8);
  outline-offset: 2px;
}

/* After Send, a picture that still needs a description gets a red edge. */
.tpg-rich-editor.is-invalid .tpg-rich-editor__surface img[alt=""]:not([data-decorative]) {
  outline: 2px solid var(--tpg-prose-editor-danger-color);
  outline-offset: 2px;
}

.tpg-rich-editor__surface a {
  color: var(--tpg-800);
  text-decoration: underline;
}

.tpg-rich-editor__surface:empty::before {
  content: attr(data-placeholder);
  color: var(--tpg-prose-editor-muted-color);
}

.tpg-rich-editor__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  padding: 0.45rem 0.75rem;
  border-top: 1px solid var(--prose-editor-typographic);
  color: var(--tpg-prose-editor-muted-color);
  font-size: 0.78rem;
}

.tpg-rich-editor__footer i {
  margin-right: 0.3rem;
}

.tpg-rich-editor__notice {
  color: var(--tpg-prose-editor-success-color);
  font-weight: 600;
}

.tpg-rich-editor__notice.is-error {
  color: var(--tpg-prose-editor-danger-color);
}

/* Style menu, link and picture panels float under the toolbar. */
.tpg-rich-editor__pop {
  position: absolute;
  z-index: 5;
  width: min(22rem, calc(100% - 1rem));
  padding: 0.85rem;
  border: 1px solid var(--prose-editor-border-color);
  border-radius: var(--bs-border-radius);
  background: var(--prose-editor-background);
  box-shadow: var(--tpg-prose-editor-pop-shadow);
  color: var(--prose-editor-foreground);
  font-size: 0.85rem;
}

.tpg-rich-editor__pop[hidden] {
  display: none;
}

.tpg-rich-editor__pop-title {
  margin: 0 0 0.55rem;
  color: var(--tpg-900);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0;
}

/* Two classes, so base.css's dark-theme label colour does not reach the
   light paper. */
.tpg-rich-editor .tpg-rich-editor__label {
  display: block;
  margin: 0.55rem 0 0.25rem;
  color: var(--tpg-prose-editor-muted-color);
  font-size: 0.76rem;
  font-weight: 600;
}

.tpg-rich-editor__input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--prose-editor-border-color);
  border-radius: 0.5rem;
  background: var(--tpg-prose-editor-field-bg);
  color: var(--prose-editor-foreground);
  font-size: 0.85rem;
}

.tpg-rich-editor__input::placeholder {
  color: var(--tpg-prose-editor-muted-color);
  opacity: 1;
}

.tpg-rich-editor__input:focus {
  outline: 0;
  border-color: var(--tpg-400);
  box-shadow: var(--tpg-focus-ring);
}

/* Focus returns to a field that failed, so the red edge must beat :focus. */
.tpg-rich-editor__input.is-invalid,
.tpg-rich-editor__input.is-invalid:focus {
  border-color: var(--tpg-prose-editor-danger-color);
}

.tpg-rich-editor__input:disabled {
  background: var(--light-200);
  color: var(--tpg-prose-editor-muted-color);
}

.tpg-rich-editor__error {
  margin-top: 0.3rem;
  color: var(--tpg-prose-editor-danger-color);
  font-size: 0.76rem;
  font-weight: 600;
}

.tpg-rich-editor__error[hidden] {
  display: none;
}

.tpg-rich-editor__check {
  min-height: 0;
  margin: 0.55rem 0 0;
}

.tpg-rich-editor .tpg-rich-editor__check .form-check-input {
  --bs-form-check-bg: var(--tpg-prose-editor-field-bg);
}

.tpg-rich-editor .tpg-rich-editor__check .form-check-input:not(:checked) {
  border-color: var(--tpg-prose-editor-muted-color);
}

.tpg-rich-editor .tpg-rich-editor__check-label {
  padding: 0;
  color: var(--prose-editor-foreground);
  font-size: 0.8rem;
}

.tpg-rich-editor__pop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.tpg-rich-editor__pop .btn-outline-secondary {
  --bs-btn-color: var(--tpg-900);
  --bs-btn-border-color: var(--tpg-prose-editor-control-border-color);
  --bs-btn-hover-color: var(--tpg-900);
  --bs-btn-hover-bg: var(--tpg-prose-editor-hover-bg);
  --bs-btn-hover-border-color: var(--tpg-prose-editor-control-hover-border-color);
}

.tpg-rich-editor__style-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 0;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--prose-editor-foreground);
  text-align: left;
}

.tpg-rich-editor__style-option:hover,
.tpg-rich-editor__style-option:focus-visible {
  outline: 0;
  background: var(--tpg-prose-editor-hover-bg);
}

/* A check marks the current style (role="menuitemradio"). */
.tpg-rich-editor__style-option i {
  flex: 0 0 0.8rem;
  font-size: 0.7rem;
  visibility: hidden;
}

.tpg-rich-editor__style-option[aria-checked="true"] i {
  visibility: visible;
}

.tpg-rich-editor__style-option[data-block="h2"] {
  font-family: 'Ivy Presto', Georgia, serif;
  font-size: 1.45rem;
  font-weight: 300;
  line-height: 1.15;
}

.tpg-rich-editor__style-option[data-block="h3"] {
  font-family: 'Ivy Presto', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 300;
  line-height: 1.15;
}

.tpg-rich-editor .tpg-rich-editor__drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.9rem;
  border: 1px dashed var(--tpg-prose-editor-control-hover-border-color);
  border-radius: 0.6rem;
  color: var(--tpg-prose-editor-muted-color);
  text-align: center;
  cursor: pointer;
}

.tpg-rich-editor .tpg-rich-editor__drop:hover,
.tpg-rich-editor .tpg-rich-editor__drop:focus-within {
  border-color: var(--tpg-700);
  color: var(--tpg-900);
}

/* The upload icon sits on its own line, a step larger than the label. */
.tpg-rich-editor .tpg-rich-editor__drop > i {
  font-size: 1.25rem;
}

/* ---- Composer pieces -------------------------------------------------- */

.tpg-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.75rem;
}

.tpg-option-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--tpg-card-panel-header-border);
  border-radius: var(--bs-border-radius);
  cursor: pointer;
  transition: border-color var(--tpg-motion-duration-fast) var(--tpg-motion-ease-standard);
}

.tpg-option-card:hover {
  border-color: var(--bs-primary-border-subtle);
}

.tpg-option-card:has(input:checked) {
  border-color: var(--gold);
  background: rgba(var(--bs-primary-rgb), 0.08);
}

[data-bs-theme="light"] .tpg-option-card:has(input:checked) {
  border-color: var(--tpg-700);
}

.tpg-option-card .form-check-input {
  flex: 0 0 auto;
  margin-top: 0.2rem;
}

.tpg-option-card__title {
  display: block;
  color: var(--bs-emphasis-color);
  font-weight: 600;
}

.tpg-option-card__help {
  display: block;
  margin-top: 0.2rem;
  color: var(--bs-secondary-color);
  font-size: 0.8rem;
  line-height: 1.35;
}

.tpg-option-card__icon {
  flex: 0 0 auto;
  width: 1.25rem;
  margin-top: 0.15rem;
  color: var(--bs-secondary-color);
  text-align: center;
}

.tpg-office-picker {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--tpg-card-panel-header-border);
  border-radius: var(--bs-border-radius);
}

.tpg-office-picker[hidden] {
  display: none;
}

.tpg-office-picker__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.tpg-office-picker__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.5rem;
}

.tpg-office-picker .tpg-option-card {
  align-items: center;
  padding: 0.6rem 0.75rem;
}

.tpg-office-picker .form-check-input {
  margin-top: 0;
}

.tpg-office-picker__count {
  margin-left: auto;
  color: var(--bs-secondary-color);
  font-size: 0.78rem;
  white-space: nowrap;
}

.tpg-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* New pieces built on <label> stay upright: base.css italicizes bare labels. */
.tpg-choice-row .btn,
.tpg-option-card,
.tpg-rich-editor__label,
.tpg-rich-editor__drop,
.tpg-rich-editor__check-label {
  font-style: normal;
}

.tpg-audience-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.tpg-audience-stats__item {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--tpg-card-panel-header-border);
  border-radius: var(--bs-border-radius);
}

.tpg-audience-stats__value {
  display: block;
  color: var(--bs-heading-color);
  font-family: 'Ivy Presto', Georgia, serif;
  font-size: 1.65rem;
  font-weight: 300;
  line-height: 1.1;
}

.tpg-audience-stats__label {
  color: var(--bs-secondary-color);
  font-size: 0.75rem;
}

.tpg-summary-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tpg-summary-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--tpg-card-panel-header-border);
}

.tpg-summary-list li:last-child {
  border-bottom: 0;
}

.tpg-summary-list__label {
  color: var(--bs-secondary-color);
}

.tpg-summary-list__value {
  color: var(--bs-emphasis-color);
  font-weight: 600;
  text-align: right;
}

/* Small live picture of the popup inside the composer rail. */
.tpg-popup-preview {
  padding: 1rem;
  border-radius: var(--bs-border-radius);
  background:
    linear-gradient(rgba(var(--tpg-1000-rgb), 0.62), rgba(var(--tpg-1000-rgb), 0.62)),
    repeating-linear-gradient(135deg, rgba(var(--tpg-nero-rgb), 0.04) 0 12px, transparent 12px 24px);
}

.tpg-popup-preview__frame {
  max-height: 25rem;
  overflow: hidden;
  border-radius: var(--bs-border-radius);
  -webkit-mask-image: linear-gradient(var(--tpg-1000) 82%, transparent);
  mask-image: linear-gradient(var(--tpg-1000) 82%, transparent);
}

.tpg-popup-preview__frame .modal-content {
  zoom: 0.62;
  pointer-events: none;
}

.tpg-popup-preview.is-off .tpg-popup-preview__frame {
  opacity: 0.35;
  filter: grayscale(1);
}

/* The message card clips without becoming a scroll box, so the editor
   toolbar can stick to the screen (overflow: hidden from .card would trap
   it inside the card). */
.card.tpg-composer-card {
  overflow: clip;
}

.tpg-composer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.tpg-composer-actions__error {
  margin-top: 0.25rem;
  color: var(--bs-form-invalid-color);
  font-size: 0.875rem;
}

/* ---- All messages page ------------------------------------------------- */

.tpg-message-browser {
  align-items: flex-start;
}

/* The list itself is the shared .tpg-record-list; rows are buttons. */
.tpg-message-row {
  display: block;
  width: 100%;
  text-align: left;
  transition: border-color var(--tpg-motion-duration-fast) var(--tpg-motion-ease-standard);
}

.tpg-message-row:not(.tpg-record-row--current):hover {
  --tpg-record-row-border-color: var(--bs-primary-border-subtle);
}

.tpg-message-row:focus-visible {
  outline: 0;
  box-shadow: var(--tpg-focus-ring);
}

/* Light theme: the shared gold current-row marker is under 3:1 on light
   panels, so the open message uses --tpg-700, like the other light marks. */
[data-bs-theme="light"] .tpg-message-row.tpg-record-row--current {
  --tpg-record-row-border-color: var(--tpg-700);
}

[data-bs-theme="light"] .tpg-message-row.tpg-record-row--current:not(:focus-visible) {
  box-shadow: inset 0.25rem 0 0 0 var(--tpg-700);
}

.tpg-message-row__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--gold);
}

[data-bs-theme="light"] .tpg-message-row__dot {
  background: var(--tpg-700);
}

.tpg-message-row .tpg-record-row__main {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: baseline;
}

.tpg-message-row .tpg-record-row__title {
  flex: 1 1 auto;
}

.tpg-message-row:not(.is-unread) .tpg-record-row__title {
  font-weight: 500;
}

.tpg-message-row__time {
  flex: 0 0 auto;
  color: var(--bs-secondary-color);
  font-size: 0.78rem;
  white-space: nowrap;
}

.tpg-message-row .tpg-record-row__meta {
  margin-top: 0.5rem;
  gap: 0.3rem 0.4rem;
}

.tpg-message-row__seen {
  display: block;
  margin-top: 0.45rem;
  color: var(--bs-secondary-color);
  font-size: 0.85rem;
}

/* Office filter: fills what is left of the pill row, or its own row. */
.tpg-message-filters__office {
  flex: 1 1 9rem;
  width: auto;
}

.tpg-message-reader__title {
  margin: 0;
  color: var(--bs-heading-color);
  font-size: clamp(1.75rem, 1.4rem + 1vw, 2.35rem);
  line-height: 1.1;
}

.tpg-message-reader .card-header {
  padding: 1.25rem 1.5rem;
}

.tpg-message-reader .card-body {
  padding: 1.5rem;
}

/* Text styles come from utilities: small text-body-secondary fw-normal mb-0.
   The space under the title comes from base.css (.card-header .text-body-secondary). */
.tpg-message-reader__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.6rem;
}

.tpg-message-reader__manage {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--tpg-card-panel-header-border);
}

.tpg-message-reader__seen {
  min-width: 14rem;
  flex: 1 1 14rem;
  color: var(--bs-secondary-color);
  font-size: 0.82rem;
}

.tpg-message-reader__seen .progress {
  height: 0.4rem;
  margin-top: 0.35rem;
  background: rgba(var(--bs-emphasis-color-rgb), 0.1);
}

.tpg-message-reader__seen .progress-bar {
  background: var(--gold);
}

[data-bs-theme="light"] .tpg-message-reader__seen .progress-bar {
  background: var(--tpg-700);
}

/* End popup now asks here first; nothing ends until End popup is clicked. */
.tpg-message-reader__confirm {
  flex: 1 1 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--bs-danger-border-subtle);
  border-radius: var(--bs-border-radius);
  background: var(--bs-danger-bg-subtle);
  color: var(--bs-body-color);
}

.tpg-message-back {
  display: none;
}

@media (max-width: 991.98px) {
  .tpg-message-browser.is-reading .tpg-message-browser__list {
    display: none;
  }

  .tpg-message-browser:not(.is-reading) .tpg-message-browser__reader {
    display: none;
  }

  .tpg-message-back {
    display: inline-flex;
  }
}

/* Desktop: the reader stays in view while the list scrolls, so a message
   picked low in a long list opens on screen. A long message scrolls inside
   the card, which keeps its full border. */
@media (min-width: 992px) {
  .tpg-message-browser__reader {
    position: sticky;
    top: 1rem;
    align-self: flex-start;
  }

  .tpg-message-reader {
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }
}

/* ---- Link-style actions ------------------------------------------------ */

/* base.css paints .btn-link with --tpg-700, under 4.5:1 on light panels.
   These small actions use the theme's link colors instead. */
.tpg-announcement-modal__more.btn-link,
.tpg-notify-panel .btn-link:not(:disabled),
.tpg-office-picker .btn-link:not(:disabled) {
  color: var(--bs-link-color);
}

.tpg-announcement-modal__more.btn-link:hover,
.tpg-notify-panel .btn-link:not(:disabled):hover,
.tpg-office-picker .btn-link:not(:disabled):hover {
  color: var(--bs-link-hover-color);
}

/* ---- Phones ------------------------------------------------------------ */

@media (max-width: 575.98px) {
  .navbar-nav .tpg-notify-panel.dropdown-menu {
    position: fixed !important;
    top: var(--tpg-mobile-top-nav-height) !important;
    right: 0.5rem !important;
    left: 0.5rem !important;
    width: auto;
  }

  .tpg-announcement-modal .modal-header,
  .tpg-announcement-modal .modal-body,
  .tpg-announcement-modal .modal-footer {
    padding-right: 1.1rem;
    padding-left: 1.1rem;
  }

  .tpg-announcement-modal .modal-footer .btn {
    flex: 1 1 auto;
  }

  .tpg-announcement-modal__pager {
    width: 100%;
  }

  .tpg-announcement-modal__pager .btn {
    flex: 1 1 0;
  }

  .tpg-announcement-modal__more {
    order: 3;
    width: 100%;
    text-align: center;
  }
}

/* Touch-size screens (narrow, or short like a phone on its side): about 44px
   to tap Mark all as read and the popup's X. The text and the X stay put. */
@media (max-width: 575.98px), (max-height: 500px) {
  .tpg-notify-panel__action {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    margin: -0.65625rem -0.5rem;
    padding: 0 0.5rem;
  }

  .tpg-announcement-modal .modal-header .btn-close {
    padding: 0.95rem 1rem;
    margin: -0.95rem -1rem -0.95rem -0.5rem;
  }
}

/* A small phone on its side keeps the full-screen popup full, even when the
   message is short. */
@media (max-width: 575.98px) and (max-height: 500px) {
  .tpg-announcement-modal .modal-dialog {
    min-height: 100%;
    align-items: stretch;
  }
}

/* Short screens (a phone on its side): the popup scrolls as one piece so the
   message gets the room, View all messages shares the pager row, and the
   bell panel scrolls as a whole. */
@media (max-height: 500px) {
  .tpg-announcement-modal .modal-dialog-scrollable {
    height: auto;
  }

  .tpg-announcement-modal .modal-content {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .tpg-announcement-modal .modal-body {
    overflow: visible;
  }

  /* Hidden from view only: screen readers still hear "2 of 3". */
  .tpg-announcement-modal__eyebrow {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .tpg-announcement-modal .modal-footer .tpg-announcement-modal__more {
    flex: 0 0 auto;
    order: 0;
    width: auto;
  }

  .tpg-announcement-modal__pager {
    flex: 1 1 auto;
    justify-content: flex-end;
    width: auto;
  }

  .tpg-notify-panel__list {
    max-height: none;
  }

  .tpg-notify-panel {
    max-height: calc(100vh - var(--tpg-mobile-top-nav-height) - 0.5rem);
    max-height: calc(100dvh - var(--tpg-mobile-top-nav-height) - 0.5rem);
    overflow-y: auto;
  }
}

/* ---- Composer page script hooks ---------------------------------------- */

/* The composer script moves the editor surface into the branded wrapper and
 * marks its state with classes. These rules come last so they win ties with
 * the editor rules above.
 */

/* Keep the summary and preview in view beside a long message on wide screens. */
@media (min-width: 1200px) {
  .tpg-composer-rail {
    position: sticky;
    top: 1.5rem;
  }
}

/* The editor surface is moved into the branded wrapper, which draws the frame. */
.tpg-rich-editor .tpg-rich-editor__surface.ProseMirror {
  border: 0;
  border-radius: 0;
}

/* ProseMirror always renders an empty paragraph, so :empty never matches.
 * The page script sets .is-empty while the message has no text or pictures.
 */
.tpg-rich-editor__surface.is-empty::before {
  content: attr(data-placeholder);
  float: left;
  height: 0;
  color: var(--tpg-prose-editor-muted-color);
  pointer-events: none;
}

/* A selected picture gets the same edge as a hovered one. */
.tpg-rich-editor__surface img.ProseMirror-selectednode {
  outline: 2px solid rgba(var(--gold-rgb), 0.8);
  outline-offset: 2px;
}

/* alt="" means the sender marked the picture as decorative, so it is valid. */
.tpg-rich-editor.is-invalid .tpg-rich-editor__surface.ProseMirror img[alt=""]:not([data-decorative]) {
  outline: 0;
}

.tpg-rich-editor.is-invalid
  .tpg-rich-editor__surface.ProseMirror
  img[alt=""]:not([data-decorative]):hover,
.tpg-rich-editor.is-invalid
  .tpg-rich-editor__surface.ProseMirror
  img[alt=""]:not([data-decorative]).ProseMirror-selectednode {
  outline: 2px solid rgba(var(--gold-rgb), 0.8);
  outline-offset: 2px;
}

/* After Send, a picture with no description at all (no alt) gets a red edge. */
.tpg-rich-editor.is-invalid .tpg-rich-editor__surface.ProseMirror img:not([alt]) {
  outline: 2px solid var(--tpg-prose-editor-danger-color);
  outline-offset: 2px;
}

/* Let a long preview title wrap instead of pushing the popup pill out. */
.tpg-popup-preview__heading {
  min-width: 0;
}
