.toolbar-filters { display: flex; gap: 9px; align-items: center; }
.toolbar-filters select { min-width: 145px; }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #f4f8f4; }
.purpose-checks { display: block; width: 100%; min-width: 0; }
.purpose-checks label, .checkbox-line { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 7px; font-weight: 500; }
.checkbox-line input { width: auto; }

/*
 * Purpose is a user-defined grouping, so its suggestions belong to the page
 * instead of the browser's saved-form popup. Keep the input and menu within
 * their column at every desktop width; long project names wrap in the menu.
 */
.purpose-combobox {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  color: var(--ink);
  font-weight: 500;
}
.purpose-combobox > input,
.purpose-checks .purpose-text {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 42px;
  padding-right: 46px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.purpose-combobox > input:focus {
  position: relative;
  z-index: 1;
}
.purpose-toggle {
  position: absolute;
  z-index: 2;
  top: 1px;
  right: 1px;
  width: 42px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid transparent;
  border-radius: 0 8px 8px 0;
  background: transparent;
  color: #526158;
  display: grid;
  place-items: center;
  font-size: 17px;
  line-height: 1;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.purpose-toggle:hover { background: #edf2ee; color: var(--green); }
.purpose-toggle:focus-visible { outline: 2px solid #527a66; outline-offset: -3px; }
.purpose-combobox.open .purpose-toggle,
.purpose-combobox[data-open="true"] .purpose-toggle { background: #edf2ee; color: var(--green); }
.purpose-combobox.open .purpose-toggle,
.purpose-combobox[data-open="true"] .purpose-toggle { transform: rotate(180deg); }

.purpose-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  display: grid;
  gap: 3px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  max-height: min(280px, 45vh);
  margin: 0;
  padding: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 1px solid #d5ddd6;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(22, 60, 44, .16);
}
.purpose-menu [role="option"],
.purpose-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #294638;
  text-align: left;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.purpose-menu button { cursor: pointer; }
.purpose-menu button:disabled { cursor: default; opacity: .65; }
.purpose-menu [role="option"]:hover,
.purpose-menu [role="option"]:focus-visible,
.purpose-menu [role="option"].active,
.purpose-menu [role="option"].is-active,
.purpose-option:hover,
.purpose-option:focus-visible,
.purpose-option.active,
.purpose-option.is-active {
  outline: 0;
  background: #eaf2ed;
  color: #174b32;
}
.purpose-menu [role="option"][aria-selected="true"],
.purpose-option[aria-selected="true"] {
  background: #dcebe2;
  color: #174b32;
  box-shadow: inset 3px 0 #3d7b58;
}
.purpose-option-main,
.purpose-option-name { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.purpose-option-meta,
.purpose-option-count { color: #7a8981; font-size: 10px; font-weight: 500; white-space: nowrap; }
.purpose-option.create,
.purpose-option-create { color: #1f6444; border-top: 1px solid #e7ece8; border-radius: 0 0 7px 7px; }
.purpose-empty,
.purpose-menu-empty {
  padding: 12px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.55;
  text-align: center;
  overflow-wrap: anywhere;
}
.purpose-hint { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.5; }

/* A menu inside the scrollable dialog participates in layout, so the lower
   part of the list and the sticky Save/Cancel actions never get clipped. */
dialog .purpose-combobox { z-index: auto; }
dialog .purpose-menu {
  position: static;
  max-height: 220px;
  margin-top: 6px;
  box-shadow: 0 9px 24px rgba(22, 60, 44, .10);
}
dialog .purpose-checks { padding: 0; border: 0; border-radius: 0; }
.two-cols > label,
.form-card > label { min-width: 0; }
.target-row.disabled { background: #fff8f7; color: #8c5a55; opacity: .78; }
.target-row.disabled select { background: #f3efee; color: #8c7773; }
.related-list { display: grid; gap: 7px; }
.related-list > strong { margin-bottom: 3px; }
.related-item { border: 1px solid var(--line); background: #f8faf8; border-radius: 8px; padding: 10px 12px; display: flex; justify-content: space-between; text-align: left; }
.related-item span { color: var(--green); }
.contact-game-card { border: 1px solid var(--line); border-left: 4px solid #6f9a7f; border-radius: 12px; padding: 15px; background: #fbfcfa; display: grid; gap: 14px; min-width: 0; }
.contact-game-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.contact-game-head h3 { margin: 3px 0 0; overflow-wrap: anywhere; }
.field-caption { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.contact-game-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.contact-game-fields > div { border: 1px solid #e1e7e1; border-radius: 8px; padding: 9px 11px; background: #fff; min-width: 0; }
.contact-game-fields span, .contact-game-fields strong, .contact-game-fields a { display: block; overflow-wrap: anywhere; word-break: break-word; }
.contact-game-fields > div > span:first-child { color: var(--muted); font-size: 10px; margin-bottom: 4px; }
.contact-game-fields strong, .contact-game-fields a { font-size: 12px; }
.contact-game-fields a, .contact-channel-item a { color: var(--green); text-decoration: none; }
.contact-game-fields a:hover, .contact-channel-item a:hover { text-decoration: underline; }
.contact-channel-section { display: grid; gap: 8px; }
.subsection-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.subsection-title span { color: var(--muted); font-size: 11px; }
.contact-channel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; min-width: 0; }
.contact-channel-item { border: 1px solid #dde6df; border-radius: 8px; padding: 9px 11px; background: #fff; min-width: 0; }
.contact-channel-item b, .contact-channel-item .channel-kind, .contact-channel-item a, .contact-channel-item .channel-plain-value, .contact-channel-item small { display: block; overflow-wrap: anywhere; word-break: break-word; }
.contact-channel-item b { font-size: 11px; margin-bottom: 3px; }
.contact-channel-item .channel-kind { color: #567163; font-size: 10px; margin-bottom: 5px; }
.contact-channel-item a, .contact-channel-item .channel-plain-value { font-size: 11px; }
.contact-channel-item small { color: var(--muted); margin-top: 4px; }
.missing-value { color: #9c7440; font-size: 11px; }
.empty-state.compact { padding: 14px; min-height: 0; }
.channel-list { display: grid; gap: 8px; }
.channel-row { display: grid; grid-template-columns: 130px 150px 1fr 32px; gap: 7px; align-items: center; }
.channel-row .icon-button { color: #99443c; }
.result-item .button { white-space: nowrap; }
dialog { max-height: calc(100vh - 32px); overflow: hidden; }
#contact-dialog, #game-dialog, #campaign-dialog { width: min(900px, calc(100vw - 32px)); }
dialog .dialog-form.wide { width: 100%; min-width: 0; }
dialog .dialog-form { max-height: calc(100vh - 32px); overflow-y: auto; }
dialog .dialog-head { position: sticky; top: -25px; z-index: 3; background: #fff; padding: 25px 0 12px; }
dialog .dialog-actions { position: sticky; bottom: -25px; z-index: 3; background: #fff; padding: 12px 0 25px; }
.steam-workspace { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(360px, .8fr); gap: 18px; align-items: start; }
.steam-main-column { min-width: 0; display: grid; gap: 14px; }
.steam-workspace .form-card { max-width: none; }
.steam-main-column .results-list { max-width: none; margin-top: 0; }
.steam-progress-card { position: sticky; top: 18px; max-height: 620px; overflow: hidden; }
.steam-progress { display: grid; gap: 8px; max-height: 520px; overflow-y: auto; overflow-x: hidden; padding-right: 4px; }
.progress-item { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; background: #fafbf9; }
.progress-item strong, .progress-item small, .progress-item small span { display: block; }
.progress-item strong { font-size: 12px; white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
.progress-item small { color: var(--muted); margin-top: 5px; line-height: 1.55; }
.progress-item.running { border-color: #8aaa98; background: #f0f6f2; }
.progress-item.running small::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border: 2px solid #b9cabf; border-top-color: var(--green); border-radius: 50%; animation: progress-spin .8s linear infinite; }
.progress-item.done { border-left: 3px solid #4c9669; }
.progress-item.failed { border-left: 3px solid var(--coral); background: #fff8f7; }
.enrichment-panel { border: 1px solid #edcf92; background: #fffdf8; margin-bottom: 16px; }
.contact-list-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: -4px 0 16px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.contact-view-buttons { display: flex; gap: 8px; align-items: center; }
.contact-all-button { background: #edf1ed; color: #234135; border: 1px solid #d8e0d9; }
.contact-all-button.active { background: var(--forest); color: #fff; }
.pending-button { background: #fff1ca; color: #7b5200; border: 1px solid #e6bd54; }
.pending-button b { min-width: 22px; height: 22px; border-radius: 999px; display: inline-grid; place-items: center; background: #d99b16; color: #fff; }
.pending-button.active { background: #e2a724; color: #fff; border-color: #ce9413; }
.warning-button { background: #fff1ca; color: #7b5200; border: 1px solid #e6bd54; }
.warning-button:hover { background: #f9df99; }
.enrichment-list { display: grid; gap: 8px; }
.enrichment-item { width: 100%; border: 1px solid #eadfca; border-left: 4px solid var(--amber); border-radius: 10px; background: #fff; padding: 13px 15px; display: flex; justify-content: space-between; align-items: center; text-align: left; }
.enrichment-item:hover { background: #fffaf0; }
.enrichment-item strong, .enrichment-item span { display: block; }
.enrichment-item span { color: var(--muted); font-size: 11px; margin-top: 4px; }
.enrichment-meta { display: flex; align-items: center; gap: 12px; }
.enrichment-meta span { margin: 0; }
.highlight-editor pre,
.highlight-editor textarea,
.highlight-editor input {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0;
  font-variant-ligatures: none;
  tab-size: 4;
}
.highlight-editor .token { display: inline; margin: 0; padding: 0; border-radius: 3px; font: inherit; line-height: inherit; letter-spacing: inherit; }
.highlight-editor textarea::selection,
.highlight-editor input::selection { background: #356bd8; color: #fff; }
.target-list-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; min-width: 0; }
.target-row > span { min-width: 0; }
.target-row strong, .target-row small { display: block; overflow-wrap: anywhere; word-break: break-word; }
.target-row small { margin-top: 4px; color: var(--muted); font-weight: 400; }
.target-list-heading .field-label { margin: 0; }
.target-selection-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.target-selection-actions span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.button.compact { padding: 7px 11px; font-size: 11px; }
.contact-attention-row { background: #fff8f2; }
.contact-attention-row:hover { background: #fff2e8; }
.contact-attention-row td:first-child { box-shadow: inset 4px 0 #d66a55; }
.contact-archived-row { background: #f3f3f1; color: #788078; }
.contact-archived-row:hover { background: #eceeeb; }
.contact-archived-row td:first-child { box-shadow: inset 4px 0 #8a918b; }
.split-actions { justify-content: space-between; gap: 16px; }
.split-actions > div { display: flex; gap: 9px; align-items: center; }
.purpose-management-list { display: grid; gap: 9px; min-height: 120px; }
.purpose-management-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.purpose-management-row strong, .purpose-management-row span { display: block; overflow-wrap: anywhere; }
.purpose-management-row span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.purpose-management-row.archived { background: #f3f3f1; color: #778078; }
.conversation-game-assignment { display: flex; align-items: center; gap: 7px; margin-top: 9px; color: var(--muted); font-size: 10px; }
.conversation-game-assignment select { width: min(280px, 42vw); padding: 7px 9px; font-size: 11px; }
.preview-email.delivery-failed { border-color: #e7a098; background: #fff8f7; }
.preview-email.delivery-failed summary { background: #fff0ed; }
.conversation-sidebar { height: 100%; min-height: 0; overflow: hidden; }
.conversation-list { flex: 1 1 auto; height: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
@keyframes progress-spin { to { transform: rotate(360deg); } }
@media (max-width: 760px) {
  .toolbar-filters { align-items: stretch; flex-direction: column; }
  .channel-row { grid-template-columns: 1fr 1fr 32px; }
  .channel-row .channel-value { grid-column: 1 / -1; }
  .contact-game-head { align-items: stretch; flex-direction: column; }
  .contact-game-fields, .contact-channel-grid { grid-template-columns: 1fr; }
  .purpose-menu { position: static; max-height: 220px; margin-top: 6px; box-shadow: 0 9px 24px rgba(22, 60, 44, .10); }
  .target-list-heading, .target-selection-actions { align-items: stretch; flex-direction: column; }
  .split-actions, .purpose-management-row, .conversation-game-assignment { align-items: stretch; flex-direction: column; }
  .conversation-game-assignment select { width: 100%; }
}
@media (max-width: 1100px) { .steam-workspace { grid-template-columns: 1fr; } .steam-progress-card { position: static; } .contact-list-toolbar { align-items: stretch; flex-direction: column; } .contact-view-buttons { justify-content: flex-end; } }
