/*
  AFS Connect — base styles for the four-tab shell.

  Palette / sizing matches the approved wireframe at
  afs_connect_wireframe.html (workspace folder). Tab content is
  intentionally placeholder — feature work lands in follow-up PRs
  starting with the Inbox tab.
*/

:root {
  --color-bg-page: #f3f2f1;
  --color-bg-app: #ffffff;
  --color-bg-soft: #fafafa;
  --color-bg-tab-active: #f5f4ff;
  --color-border: #e1dfdd;
  --color-text: #242424;
  --color-text-muted: #616161;
  --color-text-subtle: #888888;
  --color-primary: #4b53bc;        /* Teams purple */
  --color-primary-hover: #3a42a8;
  --color-accent: #c8102e;         /* Filta red */
  --font-stack: -apple-system, "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --header-h: 56px;
  --tabbar-h: 60px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-stack);
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg-page);
  overflow: hidden;
}

/* ---- Shell layout ---- */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--color-bg-app);
}

.app-header {
  height: var(--header-h);
  padding: 0 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.app-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.app-title .accent { color: var(--color-accent); }
.app-meta {
  font-size: 12px;
  color: var(--color-text-muted);
}

.app-outlet {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--color-bg-app);
}

/* ---- Bottom tab bar ---- */
.tabbar {
  height: var(--tabbar-h);
  background: var(--color-bg-app);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-shrink: 0;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 12px;
  color: var(--color-text-muted);
  cursor: pointer;
  border: 0;
  border-top: 2px solid transparent;
  background: transparent;
  user-select: none;
  font-family: inherit;
}
.tab:hover { background: var(--color-bg-soft); }
.tab.active {
  color: var(--color-primary);
  border-top-color: var(--color-primary);
  background: var(--color-bg-tab-active);
  font-weight: 600;
}
.tab svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.tab:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -3px;
}

/* ---- Placeholder tab panels ---- */
.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 10px;
  padding: 32px;
  text-align: center;
  color: var(--color-text-muted);
}
.placeholder h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}
.placeholder p {
  margin: 0;
  max-width: 440px;
  line-height: 1.5;
  font-size: 13px;
}
.placeholder .next {
  margin-top: 14px;
  padding: 6px 12px;
  background: var(--color-bg-tab-active);
  border: 1px solid #d6d2ff;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* ---- Teams dark theme override (best-effort; full theming is a follow-up) ---- */
body.theme-dark {
  --color-bg-page: #1f1f1f;
  --color-bg-app: #2b2b2b;
  --color-bg-soft: #333333;
  --color-bg-tab-active: #3a3a55;
  --color-border: #3f3f3f;
  --color-text: #f3f3f3;
  --color-text-muted: #c8c8c8;
  --color-text-subtle: #9b9b9b;
}
body.theme-contrast {
  --color-bg-page: #000000;
  --color-bg-app: #000000;
  --color-bg-soft: #1a1a1a;
  --color-bg-tab-active: #1a1a4a;
  --color-border: #ffffff;
  --color-text: #ffffff;
  --color-text-muted: #ffff00;
  --color-text-subtle: #ffff00;
  --color-primary: #ffff00;
  --color-accent: #00ffff;
}

/* ---- Inbox tab ---- */
.inbox-root {
  display: flex;
  height: 100%;
  min-height: 0;
}
.thread-list {
  /* Width is set inline by inbox.js (Ticket B — Monday #197 resizable
     divider). The 320px below acts as a fallback if JS hasn't applied
     a width yet; once mounted, an inline `flex: 0 0 Npx` overrides this. */
  width: 320px;
  flex: 0 0 320px;
  min-width: 220px;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-soft);
  /* border-right replaced by the dedicated .thread-resizer element. */
}
/* Ticket B — Monday #197. Draggable divider between thread list and
   thread pane. Slim hit target with a hover/drag accent. */
.thread-resizer {
  flex: 0 0 6px;
  cursor: col-resize;
  background: transparent;
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  transition: background 120ms ease;
  user-select: none;
  touch-action: none;
}
.thread-resizer:hover,
.thread-resizer:focus-visible,
body.inbox-dragging .thread-resizer {
  background: var(--color-accent);
  outline: none;
}
body.inbox-dragging,
body.inbox-dragging * {
  cursor: col-resize !important;
  user-select: none !important;
}


.thread-search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-app);
}
.thread-search input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #d1d1d1;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
}
.thread-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.thread-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #ececec;
  padding: 12px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--color-text);
}
.thread-item:hover { background: #f0eeff; }
.thread-item.active {
  background: #e7e4ff;
  border-left: 3px solid var(--color-primary);
  padding-left: 11px;
}
.thread-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.thread-name-wrap {
  display: flex;
  align-items: baseline;
  min-width: 0;
  overflow: hidden;
}
.thread-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread-time {
  font-size: 11px;
  color: var(--color-text-subtle);
  flex-shrink: 0;
}

/* Sender-identity badges (Inbox thread list + header). Option B palette:
   blue = existing customer, Filta green = known staff/tech, amber = unknown. */
.sender-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.sender-badge.customer { background: #e3f1f6; color: #1d6f8b; }   /* Filta blue, dulled */
.sender-badge.staff    { background: #edf6e2; color: #4f7a2e; }   /* Filta green */
.sender-badge.tech     { background: #edf6e2; color: #4f7a2e; }   /* tech = known staff */
.sender-badge.unknown  { background: #fbeed2; color: #8a5a00; }   /* amber */
.thread-header-title .sender-badge { margin-left: 8px; }
.thread-preview {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread-unread .thread-name { color: var(--color-primary); }
.thread-unread .thread-name::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--color-accent);
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
}

.thread-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--color-bg-app);
}
.thread-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.thread-customer {
  font-weight: 600;
  font-size: 15px;
  color: var(--color-text);
}
.thread-meta {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 3px;
}
.thread-actions { display: flex; gap: 6px; }
.thread-empty {
  color: var(--color-text-muted);
  font-style: italic;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
  border: 0;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  font-family: inherit;
}
.btn-primary:hover { background: var(--color-primary-hover); }
/* Bug #12020469937 — disabled treatment was a barely-noticeable 0.6 opacity
   on the same primary background, so operators couldn't tell at a glance
   whether the button was sendable. Swap to a muted grey background + grey
   text + opacity 0.7 so disabled clearly reads as "not clickable". */
.btn-primary[disabled],
.btn-primary[disabled]:hover {
  background: #d1d1d1;
  color: #6e6e6e;
  cursor: not-allowed;
  opacity: 0.7;
  box-shadow: none;
}

/* Bug #12015405052 — contact picker on operator-added matched rows.
   Sits in the same slot as the plain ".compose-matched-contact" line
   so the row layout doesn't shift when the picker appears. */
.compose-matched-contact-picker {
  display: flex;
  align-items: center;
  gap: 6px;
}
.compose-matched-contact-select {
  font: inherit;
  font-size: 12px;
  padding: 2px 6px;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  background: var(--color-bg-app);
  color: var(--color-text);
  max-width: 100%;
}

.btn-ghost {
  background: var(--color-bg-app);
  color: #424242;
  border: 1px solid #d1d1d1;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}
.btn-ghost:hover { background: var(--color-bg-soft); }

.messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: var(--color-bg-soft);
  display: flex;
  flex-direction: column;
}
.msg-day {
  text-align: center;
  font-size: 11px;
  color: var(--color-text-subtle);
  margin: 12px 0;
}
.msg {
  margin-bottom: 14px;
  max-width: 70%;
  display: flex;
  flex-direction: column;
}
.msg.inbound { align-self: flex-start; }
.msg.outbound { align-self: flex-end; }
.msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.inbound .msg-bubble {
  background: var(--color-bg-app);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}
.msg.outbound .msg-bubble {
  background: var(--color-primary);
  color: white;
}
.msg-meta {
  font-size: 11px;
  color: var(--color-text-subtle);
  margin-top: 4px;
  padding: 0 4px;
}
.msg.outbound .msg-meta { text-align: right; }
/* Staff sender attribution label above outbound bubbles (Monday #12122708618).
   Subtle gray, small — iMessage/Slack group-sender style. No colored pill. */
.msg-sender {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-subtle);
  margin: 0 4px 3px;
}
.msg.outbound .msg-sender { text-align: right; }

.reply-box {
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-app);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}
.reply-box textarea {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #d1d1d1;
  border-radius: 4px;
  font-size: 14px;
  resize: none;
  height: 40px;
  max-height: 120px;
  font-family: inherit;
}
.reply-box textarea:disabled { background: #f5f5f5; }

.empty {
  padding: 24px 16px;
  color: var(--color-text-muted);
  font-size: 13px;
  text-align: center;
}
.empty.error { color: var(--color-accent); }

/* ---- Compose tab ---- */
.compose-root {
  padding: 20px 24px;
  overflow-y: auto;
  height: 100%;
}
.compose-card {
  max-width: 720px;
  margin: 0 auto 14px;
  background: var(--color-bg-app);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 18px 22px;
}
.compose-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--color-text);
}
.compose-sub {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 0 0 16px;
}
.compose-step {
  border: 0;
  padding: 12px 0;
  margin: 0;
  border-top: 1px solid #f0f0f0;
}
.compose-step:first-of-type { border-top: 0; }
.compose-step legend {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 0;
  margin-bottom: 8px;
}
.compose-step[disabled] { opacity: 0.5; pointer-events: none; }
.compose-lbl {
  display: block;
  font-size: 12px;
  color: #424242;
  margin-bottom: 4px;
  font-weight: 500;
}
.compose-step input[type="text"],
.compose-step select,
.compose-step textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d1d1;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  background: var(--color-bg-app);
  color: var(--color-text);
}
.compose-step textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.4;
}
.compose-help {
  font-size: 11px;
  color: var(--color-text-muted);
  margin: 6px 0 0;
}
.compose-help.compose-warn { color: #8b5a00; }
.compose-help.compose-mono {
  font-family: Consolas, "SF Mono", monospace;
  font-size: 12px;
}
.compose-muted { color: var(--color-text-subtle); }

.compose-results {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--color-bg-app);
  display: none;
}
.compose-results li {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid #f0f0f0;
}
.compose-results li:last-child { border-bottom: 0; }
.compose-results li:hover { background: var(--color-bg-tab-active); }
.compose-result-name { font-weight: 600; font-size: 13px; }
.compose-result-meta { font-size: 11px; color: var(--color-text-muted); }

.compose-selected:empty { display: none; }
.compose-selected-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid #c5cefa;
  border-radius: 4px;
  background: #f0f4ff;
  gap: 12px;
  margin-top: 6px;
}
.compose-selected-name { font-weight: 600; }
.compose-selected-meta { font-size: 11px; color: var(--color-text-muted); margin-top: 2px; }

.compose-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}
/* PR #91 Bug A regression fix: .compose-actions has display:flex, which
   overrides the UA stylesheet's [hidden]{display:none}. Re-state the
   default explicitly at higher specificity so setting element.hidden=true
   in setMode() actually hides #compose-single-actions in filter mode. */
.compose-actions[hidden] { display: none; }

.compose-error {
  margin-top: 12px;
  padding: 8px 12px;
  background: #ffebee;
  border: 1px solid #ffcdd2;
  border-radius: 4px;
  color: #b71c1c;
  font-size: 13px;
}

.compose-kv {
  margin: 6px 0 12px;
  padding: 0;
}
.compose-kv-row {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
}
.compose-kv-row:last-child { border-bottom: 0; }
.compose-kv dt {
  width: 100px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}
.compose-kv dd { margin: 0; font-size: 13px; }

.compose-warn {
  font-size: 12px;
  color: #8b5a00;
  background: #fff4e0;
  border: 1px solid #ffd591;
  border-radius: 4px;
  padding: 8px 12px;
  margin: 0 0 12px;
}

/* ---- Sent Log tab ---- */
.sent-log-root {
  padding: 16px 20px;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 12px;
}
.table-title { font-size: 15px; font-weight: 600; color: var(--color-text); }
.table-subtitle { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}
.filter-chip {
  padding: 6px 12px;
  background: var(--color-bg-app);
  border: 1px solid #d1d1d1;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  font-family: inherit;
  color: var(--color-text);
}
.filter-chip:hover { background: var(--color-bg-soft); }
.filter-chip.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
.filter-divider {
  width: 1px;
  height: 18px;
  background: var(--color-border);
  margin: 0 4px;
}

.sent-log-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg-app);
}
.sent-log-table {
  width: 100%;
  border-collapse: collapse;
}
.sent-log-table th {
  background: #f5f5f5;
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: #424242;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
/* Ticket #111 — sortable column headers on the Scheduled grid. */
.sent-log-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.sent-log-table th.sortable:hover {
  background: #ececec;
}
.sent-log-table th.sortable:focus-visible {
  outline: 2px solid var(--color-accent, #1264a3);
  outline-offset: -2px;
}
.sent-log-table th.sortable .sort-caret {
  font-size: 9px;
  color: #9e9e9e;
}
.sent-log-table th.sorted-asc,
.sent-log-table th.sorted-desc {
  color: var(--color-accent, #1264a3);
  background: #eef4fa;
}
.sent-log-table th.sorted-asc .sort-caret,
.sent-log-table th.sorted-desc .sort-caret {
  color: var(--color-accent, #1264a3);
}

.sent-log-table td {
  padding: 11px 12px;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
  color: var(--color-text);
}
.sent-log-table tr:last-child td { border-bottom: 0; }
.sent-log-table tr:hover td { background: #fafafa; }
.sent-log-table .truncate {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Pills used inside the table */
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
}
.pill.reminder  { background: #e8f4fd; color: #0f5995; }
.pill.marketing { background: #fff4e0; color: #8b5a00; }
.pill.replied   { background: #e8f5e8; color: #1b6b1b; }
.pill.no-reply  { background: #f0f0f0; color: #616161; }
.pill.delivered { background: #e8f5e8; color: #1b6b1b; }

/* ---- Scheduled tab — notifications preview (PR #99) ---- */
.table-note {
  border: 1px solid #f0d895;
  background: #fffaec;
  color: #6a4f00;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 12px;
}
.table-note strong {
  color: #5a3f00;
  font-weight: 600;
}

.cell-stacked {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 96px;
}
.cell-stacked-primary {
  font-size: 13px;
  color: var(--color-text);
  white-space: nowrap;
}
.cell-stacked-secondary {
  font-size: 11px;
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* ---- Scheduled tab (interim) ---- */
.scheduled-root {
  padding: 16px 20px;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.scheduled-empty {
  flex: 1;
  border: 1px dashed var(--color-border);
  border-radius: 8px;
  background: var(--color-bg-soft);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
}
.scheduled-empty h3 {
  margin: 0;
  font-size: 16px;
  color: var(--color-text);
  font-weight: 600;
}
.scheduled-empty p {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-muted);
  max-width: 540px;
  line-height: 1.5;
}
.scheduled-empty .scheduled-meta { font-size: 12px; }
.scheduled-empty code {
  background: var(--color-bg-app);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
}

/* ---- Scheduled tab — horizontal filter row (2026-05-19) ----
   Tickets #12053418204 (layout) + #12053436012 (Reset filters).
   The filter pane mirrors Compose's visual rhythm but runs its
   inputs horizontally so the table beneath can take the full page
   width. Each cell stacks label-over-input; the Reset button rides
   at the end of the row. Wraps to a stacked layout below 640px. */
.scheduled-filter-pane { padding: 12px 0; }
.scheduled-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin: 12px 0;
}
.scheduled-filter-cell {
  display: flex;
  flex-direction: column;
  flex: 1 1 160px;
  min-width: 140px;
}
.scheduled-filter-cell .compose-lbl { margin: 0 0 4px; }
.scheduled-filter-cell select,
.scheduled-filter-cell input[type="text"] {
  width: 100%;
  padding: 6px 8px;
  font: inherit;
  border: 1px solid #c5c8d2;
  border-radius: 4px;
  background: #fff;
}
.scheduled-filter-cell-action {
  flex: 0 0 auto;
  justify-content: flex-end;
}
.scheduled-filter-cell-action .btn-ghost {
  height: 32px;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .scheduled-filter-cell { flex: 1 1 100%; }
  .scheduled-filter-cell-action { align-self: stretch; }
  .scheduled-filter-cell-action .btn-ghost { width: 100%; }
}


/* ---------- Inbox thread header — enriched fields (PR #1) ---------- */

.thread-header-enriched {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.thread-header-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.thread-header-customer {
  font-weight: 600;
  font-size: 15px;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-header-contact {
  font-size: 13px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Ticket A — Monday #196.
   Combined "Contact - Account" title for the inbox preview header.
   Single ellipsis so the relationship between person and customer
   truncates as one unit instead of two indep. pieces. */
.thread-header-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.thread-header-facts {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--color-text-muted);
}

.thread-header-fact {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

.thread-header-fact-label {
  color: var(--color-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
  font-weight: 600;
}

.thread-header-fact-value {
  color: var(--color-text);
}

.thread-header-fact-empty {
  color: var(--color-text-subtle);
  font-style: italic;
}

.thread-header-loading {
  font-size: 12px;
  color: var(--color-text-subtle);
  font-style: italic;
}

/* ----- Compose: mode toggle + filter pane (PR C v1) ----- */
.compose-mode-toggle {
  display: flex;
  gap: 6px;
  margin: 0 0 8px;
  padding: 4px;
  background: #f1f4f9;
  border-radius: 6px;
  width: fit-content;
}
.compose-mode-btn {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  font: inherit;
  cursor: pointer;
  border-radius: 4px;
  color: var(--color-text-muted);
}
.compose-mode-btn:hover { background: #e3e8f3; }
.compose-mode-on {
  background: #fff;
  color: var(--color-text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.compose-filter-pane {
  /* match .compose-step look */
}
.compose-filter-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 12px;
  align-items: center;
  margin: 12px 0;
}
.compose-filter-grid .compose-lbl { margin: 0; }
.compose-filter-grid select,
.compose-filter-grid input[type="text"] {
  width: 100%;
  padding: 6px 8px;
  font: inherit;
  border: 1px solid #c5c8d2;
  border-radius: 4px;
  background: #fff;
}

.compose-filter-count {
  margin: 12px 0;
  padding: 10px 12px;
  background: #f5f7fb;
  border: 1px solid #d8dde7;
  border-radius: 4px;
  font-size: 14px;
  color: var(--color-text);
}
.compose-filter-count-loading { color: var(--color-text-muted); font-style: italic; }
.compose-filter-count-err { background: #ffebee; color: #b71c1c; border-color: #ffcdd2; }
.compose-filter-count-over { background: #fff3e0; color: #b34900; border-color: #ffcc80; font-weight: 600; }

.compose-filter-result {
  margin-top: 14px;
  padding: 12px;
  background: #f1f8f4;
  border: 1px solid #c8e6c9;
  border-radius: 4px;
}
.compose-filter-result-title { margin: 0 0 8px; font-size: 15px; }
.compose-filter-skipped {
  list-style: disc;
  padding-left: 20px;
  margin: 4px 0;
  font-size: 13px;
}
.compose-filter-skip-customer { font-weight: 600; }
.compose-filter-skip-reason { color: var(--color-text-muted); }

/* ----- Compose: matched-recipients preview + curate (PR-D v2) ----- */
.compose-matched-wrap {
  margin: 12px 0 16px;
  padding: 10px 12px;
  background: #fdfdfd;
  border: 1px solid #d8dde7;
  border-radius: 4px;
}
.compose-matched-header {
  font-size: 13px;
  color: var(--color-text);
  margin: 0 0 8px;
  font-weight: 600;
}
.compose-matched-loading { font-style: italic; color: var(--color-text-muted); font-weight: normal; }
.compose-matched-err { color: #b71c1c; font-weight: 600; }
.compose-matched-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
}
.compose-matched-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 4px;
  border-bottom: 1px solid #eef0f4;
}
.compose-matched-row:last-child { border-bottom: 0; }
.compose-matched-removed { opacity: 0.45; text-decoration: line-through; }
.compose-matched-removed .compose-matched-toggle {
  text-decoration: none;
  opacity: 1;
}
.compose-matched-main { flex: 1; min-width: 0; }
.compose-matched-customer { font-weight: 600; font-size: 14px; }
.compose-matched-contact { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.compose-matched-next { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; font-style: italic; }
.compose-matched-toggle {
  flex-shrink: 0;
  border: 1px solid #c5c8d2;
  background: #fff;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
  color: var(--color-text);
}
.compose-matched-toggle:hover { background: #f1f4f9; border-color: #a5acbc; }

/* ----- Compose v2: Customer (optional) typeahead + cross-filter ----- */
/* Task #190 — Customer (optional) typeahead wrapper. The grid expects
   exactly one element in column 2 per label; wrap input+results in a div
   so the dropdown appears below the input without breaking the grid.
   Task #191 — this typeahead is now the sole add-customer affordance;
   the legacy "Add another opted-in customer" picker was removed. */
.compose-filter-customer-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.compose-filter-customer-wrap input[type="text"] {
  width: 100%;
  padding: 6px 8px;
  font: inherit;
  border: 1px solid #c5c8d2;
  border-radius: 4px;
  background: #fff;
}
.compose-filter-customer-results { display: none; }
.compose-filter-customer-results li.compose-add-result-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.compose-matched-added-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  background: #e8f1fb;
  color: #1565c0;
  border-radius: 8px;
  vertical-align: middle;
}

/* ----- Compose: skipped customers grid (PR-G) ----- */
.compose-matched-wrap .compose-help.compose-warn {
  /* Override the inline paragraph styling for the skipped block — it now
     contains a structured list, not paragraph text. */
  background: #fff7e6;
  border: 1px solid #ffd28a;
  color: var(--color-text);
  padding: 10px 12px;
  border-radius: 4px;
  margin-top: 10px;
}
.compose-skipped-header {
  font-weight: 600;
  margin-bottom: 6px;
}
.compose-skipped-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 180px;
  overflow-y: auto;
}
.compose-skipped-row {
  display: grid;
  grid-template-columns: 1fr max-content;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px solid #f0e3c5;
  font-size: 13px;
}
.compose-skipped-row:last-child { border-bottom: 0; }
.compose-skipped-customer { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.compose-skipped-reason {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
}


/* ----- Compose: segment preview (Item 6) ----- */
.compose-segment-preview {
  margin: -6px 0 12px;
  padding: 6px 10px;
  background: #f4f6fb;
  border: 1px solid #d8dde7;
  border-radius: 4px;
  font-size: 12px;
  color: var(--color-text-muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}
.compose-segment-preview.compose-segment-warn {
  background: #fff7e6;
  border-color: #ffd28a;
  color: #7a4d00;
  font-weight: 600;
}

/* ----- Compose: bulk-select header row + per-row checkbox (Item 3) ----- */
.compose-matched-row.compose-matched-row-head {
  padding-top: 6px;
  padding-bottom: 6px;
  background: #f9fafc;
  border-bottom: 1px solid #d8dde7;
  font-weight: 600;
}
.compose-matched-head-label {
  color: var(--color-text);
  font-size: 13px;
}
.compose-matched-row-check {
  flex-shrink: 0;
  margin-right: 4px;
  margin-top: 4px;
  cursor: pointer;
}
.compose-matched-removed .compose-matched-row-check {
  /* allow checking the box again — never struck-through */
  opacity: 1;
}

/* Item 178 — recipient-options loading + error states. */
.compose-filter-grid select[disabled] {
  background: #f5f7fb;
  color: var(--color-text-muted);
  cursor: not-allowed;
}
.compose-filter-select-loading {
  /* extra cue beyond the UA disabled styling */
  background-image: linear-gradient(90deg, rgba(0,0,0,0.04) 25%, rgba(0,0,0,0.08) 50%, rgba(0,0,0,0.04) 75%);
  background-size: 200% 100%;
  animation: compose-filter-shimmer 1.2s linear infinite;
}
@keyframes compose-filter-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.compose-filter-select-err {
  border-color: #ffcdd2 !important;
  background: #ffebee !important;
  color: #b71c1c !important;
}
.compose-filter-options-err[hidden] { display: none; }
.compose-filter-options-err {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  padding: 8px 12px;
  background: #ffebee;
  border: 1px solid #ffcdd2;
  border-radius: 4px;
  color: #b71c1c;
  font-size: 13px;
}
.compose-filter-options-err-msg { flex: 1; }
.compose-filter-options-retry {
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  background: #fff;
  color: #b71c1c;
  border: 1px solid #ffcdd2;
  border-radius: 3px;
  cursor: pointer;
}
.compose-filter-options-retry:hover { background: #ffebee; border-color: #b71c1c; }

/* A4 / Task #177 — lazy resolution row states. */
.compose-matched-row-resolving { opacity: 0.75; }
.compose-matched-row-skipped { opacity: 0.85; }
.compose-matched-row-check-stub {
  display: inline-block;
  width: 14px;
  height: 14px;
}
.compose-matched-resolving-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted);
  font-style: italic;
}
.compose-matched-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid #c5c8d2;
  border-top-color: var(--color-text);
  border-radius: 50%;
  animation: compose-matched-spin 0.8s linear infinite;
}
@keyframes compose-matched-spin { to { transform: rotate(360deg); } }
.compose-matched-skip-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  background: #fff3e0;
  color: #b34900;
  border: 1px solid #ffcc80;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  text-transform: lowercase;
}

/* ----- Ticket C — Monday #198. Outbound MMS paperclip + chip row ----- */
.btn-attach {
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-muted);
  flex-shrink: 0;
  padding: 0;
}
.btn-attach:hover:not(:disabled) {
  background: #f0eeff;
  color: var(--color-text);
}
.btn-attach:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-attach-icon { display: inline-flex; }

.attach-chips {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.attach-chips:empty { display: none; }
.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f0eeff;
  border: 1px solid #d8d3ff;
  border-radius: 12px;
  padding: 3px 6px 3px 10px;
  font-size: 12px;
  max-width: 240px;
}
.attach-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}
.attach-chip-size {
  color: var(--color-text-subtle);
  font-size: 11px;
}
.attach-chip-x {
  background: transparent;
  border: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.attach-chip-x:hover { background: rgba(0,0,0,0.08); color: var(--color-text); }
.attach-error {
  flex-basis: 100%;
  color: #b00020;
  font-size: 12px;
}

/* ----- Inbox: Service History + Next Service callouts (Tickets A + B — Monday #192 / #194) ----- */
.thread-callout {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(0,0,0,0.03);
  font-size: 12px;
  color: var(--color-text);
}
.thread-callout .callout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.thread-callout .callout-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-subtle);
}
.thread-callout .callout-expand {
  background: transparent;
  border: 0;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
}
.thread-callout .callout-expand:hover {
  background: rgba(0,0,0,0.06);
  color: var(--color-text);
}
.thread-callout .callout-loading,
.thread-callout .callout-empty {
  color: var(--color-text-subtle);
  font-style: italic;
}

/* Landscape header redesign (Monday #12084693205).
   Compact horizontal bands: the latest three services render as side-by-side
   cards in a single grid row, wrapping gracefully when the Teams pane narrows. */
.thread-callout .callout-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.thread-callout .callout-refresh {
  background: transparent;
  border: 0;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
}
.thread-callout .callout-refresh:hover {
  background: rgba(0,0,0,0.06);
  color: var(--color-text);
}

/* Empty section: one muted line, no band (no padding/background/label). */
.thread-callout-empty {
  margin-top: 10px;
  padding: 2px 2px;
  background: transparent;
  font-size: 11px;
  font-style: italic;
  color: var(--color-text-subtle);
}

.service-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
/* Wrap/shrink at narrow Teams widths — no horizontal overflow in the pane. */
@media (max-width: 520px) {
  .service-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 340px) {
  .service-card-grid { grid-template-columns: minmax(0, 1fr); }
}
.service-card {
  min-width: 0;
  padding: 6px 8px;
  border: 0.5px solid rgba(0,0,0,0.14);
  border-radius: 6px;
  background: var(--color-surface, #fff);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.service-card-date {
  font-weight: 500;
  color: var(--color-text);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.service-card-tech {
  color: var(--color-text-muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.service-card-detail {
  color: var(--color-text-subtle);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.service-card .history-flags { margin-top: 2px; }

.history-list, .schedule-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.history-row, .schedule-row {
  padding: 6px 0;
  border-top: 1px solid rgba(0,0,0,0.06);
}
.history-row:first-child, .schedule-row:first-child { border-top: 0; }
.history-row-top, .schedule-row-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.history-date, .schedule-date {
  font-weight: 600;
  color: var(--color-text);
}
.history-tech, .schedule-tech { color: var(--color-text); }
.history-route, .schedule-row-secondary {
  color: var(--color-text-muted);
  font-size: 11px;
}
.history-status {
  color: var(--color-text-muted);
  font-size: 11px;
  margin-top: 2px;
}
.history-no-service-reason {
  color: #8a4b00;
  font-size: 11px;
  margin-top: 2px;
}
.history-lines {
  margin: 4px 0 0 16px;
  padding: 0;
  color: var(--color-text-muted);
  font-size: 11px;
}
.history-line { margin: 0 0 1px 0; }

.history-flags { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.history-flag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(0,0,0,0.08);
  color: var(--color-text);
}
.history-flag-no_service_provided { background: rgba(255, 87, 34, 0.18); color: #8a3a00; }
.history-flag-missed_fryer { background: rgba(244, 67, 54, 0.18); color: #8a1c1c; }
.history-flag-extra_top_off { background: rgba(33, 150, 243, 0.18); color: #0b4d8a; }

/* ----- Modal/drawer for expanded views ----- */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-dialog {
  background: var(--color-surface, #fff);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  width: min(720px, 92%);
  max-height: 86%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.modal-title { font-weight: 600; font-size: 14px; }
.modal-subtitle {
  padding: 6px 16px 0;
  font-size: 12px;
  color: var(--color-text-muted);
}
.modal-close {
  background: transparent;
  border: 0;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0 4px;
}
.modal-close:hover { color: var(--color-text); }
.modal-body {
  padding: 12px 16px 16px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer-note {
  font-size: 11px;
  color: var(--color-text-subtle);
  font-style: italic;
  margin-top: 8px;
}
.history-list-expanded .history-row,
.schedule-list-expanded .schedule-row {
  padding: 10px 0;
}

/* --- Task #200 — Compose date/time variable builder + preview --- */
.compose-var-builder {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  margin: 8px 0;
  background: #f5f7fb;
  border: 1px solid #d8dee9;
  border-radius: 6px;
}
.compose-var-builder-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.compose-var-lbl {
  font-weight: 600;
  font-size: 13px;
  color: #2d3748;
  margin-right: 4px;
}
.compose-var-builder-row select,
.compose-var-builder-row input[type="number"] {
  font-size: 13px;
  padding: 4px 6px;
  border: 1px solid #cbd2dd;
  border-radius: 4px;
  background: #fff;
}
.compose-var-builder-row input[type="number"] {
  width: 64px;
}
.compose-var-chip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.compose-var-chip {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: #e0e7ff;
  color: #2a3a82;
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px dashed #8fa1d8;
  cursor: grab;
  user-select: none;
}
.compose-var-chip:active { cursor: grabbing; }
.compose-var-insert-btn { font-size: 12px; padding: 4px 10px; }
.compose-var-error {
  font-size: 12px;
  color: #c0392b;
}
.compose-var-preview {
  margin: 6px 0 10px;
  padding: 8px 12px;
  background: #fffbe6;
  border-left: 3px solid #f1c40f;
  border-radius: 4px;
  font-size: 13px;
}
.compose-var-preview-hdr {
  font-weight: 600;
  font-size: 12px;
  color: #7a5d00;
  margin-bottom: 4px;
}
.compose-var-preview-body {
  white-space: pre-wrap;
  color: #2c3a4e;
}

/* ----- Task #205 — STOP-state visuals (Compose row + Inbox banner) ----- */
.compose-matched-stopped-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  background: #fdecea;
  color: #b71c1c;
  border-radius: 8px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.compose-matched-row.compose-matched-stopped {
  /* Visually muted so the operator sees at a glance that the row is
     excluded from the batch. Background tint mirrors the badge color
     so the row and badge read as one signal. */
  opacity: 0.7;
  background: #fff5f5;
}
.compose-matched-row.compose-matched-stopped .compose-matched-customer span:first-child {
  text-decoration: line-through;
  text-decoration-color: #c62828;
}

/* Inbox tab — banner above the reply composer when the customer is
   opted out. Single-line at typical widths; wraps gracefully on narrow. */
.inbox-stop-banner {
  margin: 0 0 8px 0;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  background: #fdecea;
  color: #b71c1c;
  border: 1px solid #f5c0bc;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
}

/* Inbox tab — red failed-send toast above the composer (P0 silent-send fix).
   alert() no-ops inside the Teams webview, so send failures render in-DOM. */
.inbox-send-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 8px 0;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  background: #fdecea;
  color: #b71c1c;
  border: 1px solid #f5c0bc;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
}
.inbox-send-error-msg {
  flex: 1 1 auto;
}
.inbox-send-error-dismiss {
  flex: 0 0 auto;
  appearance: none;
  background: transparent;
  border: 0;
  color: #b71c1c;
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  padding: 0 2px;
}
.inbox-send-error-dismiss:hover {
  color: #7f1411;
}

/* ----- Scheduled tab — Notification Contact column (Ticket #189) ----- */
.notification-contact-cell {
  /* Real values display normal; pending placeholder gets muted styling so
     the operator can scan the column for rows still awaiting Nutshell
     data. Phone always appears via the title= tooltip — same mechanism
     Bug #182 used for notification-text. */
  cursor: default;
}
.notification-contact-cell.notification-contact-pending {
  color: var(--color-text-muted);
  font-style: italic;
}

/* ----- Scheduled tab — Filter pane width override (Ticket #185) -----
   The Scheduled filter pane reuses .compose-filter-pane styling so it
   visually matches Compose. Compose lives inside a narrower compose-card
   container, while Scheduled mounts directly inside .sent-log-root which
   stretches the whole tab width. Constrain the Scheduled filter grid
   width so the dropdowns don't stretch to half-screen — keeps the visual
   parity with Compose's grid that the ticket calls for. */
.scheduled-root .compose-filter-pane {
  max-width: 720px;
}

/* Symphony deep-link on customer names (Monday #12062762260).
   Subtle by design: inherits the surrounding text colour so names don't
   look like ads; only reveals affordance (primary colour + underline) on
   hover/focus. Applied across Inbox header, Scheduled, Compose, Sent Log. */
.symphony-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.symphony-link:hover,
.symphony-link:focus-visible {
  color: var(--color-primary);
  text-decoration: underline;
}
/* When the link is the thread-header title, keep the title's ellipsis
   behaviour (the anchor replaces the title div, so re-assert display). */
a.thread-header-title {
  display: block;
}

/* ----- Scheduled tab pagination (Ticket #110) -----
   Layout mirrors the Compose matched-recipients control rhythm: a labelled
   page-size selector on the left, range indicator + prev/next chevrons on
   the right. Card styling (bg/border/radius) matches .compose-matched-wrap
   so the two tabs read as one design system. */
.scheduled-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0 4px;
  padding: 8px 12px;
  background: #fdfdfd;
  border: 1px solid #d8dde7;
  border-radius: 4px;
  font-size: 13px;
}
.scheduled-pager[hidden] { display: none; }
.scheduled-pager-size { display: flex; align-items: center; gap: 8px; }
.scheduled-pager-size .compose-lbl { margin: 0; }
.scheduled-pager-size select {
  padding: 6px 8px;
  font: inherit;
  border: 1px solid #c5c8d2;
  border-radius: 4px;
  background: #fff;
}
.scheduled-pager-nav { display: flex; align-items: center; gap: 12px; }
.scheduled-pager-indicator { color: var(--color-text-muted); white-space: nowrap; }
.scheduled-pager-btn { padding: 4px 10px; font-size: 12px; }
.scheduled-pager-btn:disabled { opacity: 0.45; cursor: default; }
@media (max-width: 640px) {
  .scheduled-pager { flex-direction: column; align-items: stretch; }
  .scheduled-pager-nav { justify-content: space-between; }
}

/* ----- Administration tab (Admin tab + kill switch + activity log) ----- */
.admin-root { padding: 4px 0; }
.admin-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
}
.admin-section {
  border: 1px solid var(--color-border, #d9dce3);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}
.admin-section-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}
.admin-section-sub {
  margin: 0 0 12px;
  font-size: 12px;
  color: #6e7480;
}
.admin-section-body { font-size: 13px; }

.admin-switch-pill {
  display: inline-block;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.pill.admin-on  { background: #e8f5e8; color: #1b6b1b; }
.pill.admin-off { background: #fde8e8; color: #a11; }
.admin-switch-desc { margin: 10px 0 4px; }
.admin-switch-meta { margin: 4px 0 12px; color: #6e7480; font-size: 12px; }
.admin-switch-actions { margin-top: 8px; }

.admin-access { color: #8b5a00; }

/* Destructive action (suspend all sending). */
.btn-danger {
  background: #b3261e;
  color: #fff;
  border: 0;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  font-family: inherit;
}
.btn-danger:hover { background: #8c1d17; }
.btn-danger[disabled],
.btn-danger[disabled]:hover {
  background: #d1d1d1;
  color: #6e6e6e;
  cursor: not-allowed;
  opacity: 0.7;
}

.admin-activity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.admin-activity-table th,
.admin-activity-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border, #eceef2);
  vertical-align: top;
}
.admin-activity-table th {
  font-weight: 600;
  color: #6e7480;
  border-bottom: 2px solid var(--color-border, #d9dce3);
}

/* Secondary action (discard template changes). */
.btn-secondary {
  background: #f1f2f4;
  color: #3a3f47;
  border: 1px solid var(--color-border, #d9dce3);
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  font-family: inherit;
}
.btn-secondary:hover { background: #e6e8eb; }
.btn-secondary[disabled],
.btn-secondary[disabled]:hover {
  background: #f1f2f4;
  color: #a6abb3;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Reminder template editor. */
.admin-template-input {
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  padding: 8px 10px;
  border: 1px solid var(--color-border, #d9dce3);
  border-radius: 4px;
  resize: vertical;
}
.admin-template-vars {
  margin: 8px 0 4px;
  font-size: 12px;
  color: #6e7480;
}
.admin-template-vars-label { margin-right: 4px; }
.admin-var-token {
  display: inline-block;
  background: #eef1f6;
  border: 1px solid var(--color-border, #d9dce3);
  border-radius: 3px;
  padding: 1px 6px;
  margin: 0 4px 4px 0;
  font-size: 12px;
  color: #3a3f47;
  cursor: default;
}

/* Demo send. */
.admin-demo-preview {
  background: #f6f8fb;
  border: 1px solid var(--color-border, #eceef2);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.admin-demo-preview-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6e7480;
  margin-bottom: 4px;
}
.admin-demo-preview-body {
  font-size: 13px;
  line-height: 1.45;
  color: #2a2e35;
  white-space: pre-wrap;
}
.admin-demo-phone-label {
  display: block;
  font-size: 12px;
  color: #6e7480;
  margin-bottom: 4px;
}
.admin-demo-row { display: flex; gap: 8px; align-items: center; }
.admin-demo-phone {
  flex: 1;
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--color-border, #d9dce3);
  border-radius: 4px;
}
.admin-demo-status { margin-top: 8px; font-size: 12px; min-height: 16px; }
.admin-demo-status.ok { color: #1a7f37; }
.admin-demo-status.error { color: #b3261e; }

/* --- Bug #12105391656 — in-app confirm modal + inline notices.
   Teams' webview silently suppresses window.confirm/alert/prompt, so every
   Admin control confirms via an in-iframe modal (reuses .modal-backdrop /
   .modal-dialog) and reports validation inline instead of via alert(). --- */
.admin-confirm-dialog { width: min(420px, 92%); max-height: none; }
.admin-confirm-msg {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--color-text);
}
.admin-confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.admin-notice { margin-top: 8px; font-size: 12px; min-height: 16px; }
.admin-notice.error { color: #b3261e; }

/* ===== Admin tab — Option B left-nav settings redesign (#12115041819) +
   live "what the customer sees" message preview (#12115041843).
   Filta palette: green #7BBA4C, blue dulled to #2a86a6, cream #F8F5F1. ===== */
.admin-shell {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 18px;
  align-items: start;
  padding: 16px;
  background: #f8f5f1;
}

/* Sticky left-nav. Sticks within #outlet (the tab's scroll container). */
.admin-nav {
  position: sticky;
  top: 0;
  align-self: start;
  background: #fff;
  border: 1px solid #e4ded5;
  border-radius: 10px;
  padding: 14px 0;
}
.admin-nav-head {
  padding: 0 16px 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8a8a8a;
  font-weight: 700;
}
.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  color: #5f5f5f;
  text-decoration: none;
  font-size: 13px;
  border-left: 3px solid transparent;
  cursor: pointer;
  user-select: none;
}
.admin-nav-link:hover { background: #faf8f4; }
.admin-nav-link.active {
  background: #eaf3f7;
  border-left-color: #2a86a6;
  color: #2a86a6;
  font-weight: 600;
}
.admin-nav-link:focus-visible { outline: 2px solid #2a86a6; outline-offset: -2px; }
.admin-nav-ic { width: 16px; text-align: center; opacity: 0.8; }

.admin-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* Card-ify each setting section (override the flat .admin-section box). */
.admin-shell .admin-section {
  padding: 0;
  overflow: hidden;
  scroll-margin-top: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 6px rgba(0, 0, 0, 0.04);
}
.admin-section-head {
  padding: 13px 18px;
  border-bottom: 1px solid #e4ded5;
  background: #faf8f4;
}
.admin-section-head .admin-section-title { margin: 0; }
.admin-section-head .admin-section-sub { margin: 3px 0 0; }
.admin-section-content { padding: 16px 18px; }
.admin-section-content-flush { padding: 0; }

/* Live customer-preview bubble (phone style). */
.admin-preview {
  margin-top: 12px;
  border: 1px dashed #d8cfc1;
  border-radius: 10px;
  background: #faf8f4;
  padding: 12px 14px;
}
.admin-preview-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #8a8a8a;
  margin: 0 0 8px;
}
.admin-preview-bubble {
  max-width: 300px;
  background: #e7e6eb;
  color: #1c1c1c;
  border-radius: 16px 16px 16px 4px;
  padding: 10px 13px;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.admin-preview-cap { font-size: 11px; color: #8a8a8a; margin: 8px 0 0; }

/* Activity log: capped, internally scrolling, sticky header. */
.admin-log-scroll { max-height: 260px; overflow-y: auto; }
.admin-shell .admin-activity-table th {
  position: sticky;
  top: 0;
  background: #faf8f4;
  z-index: 1;
}
.admin-log-foot {
  padding: 8px 14px;
  font-size: 12px;
  color: #8a8a8a;
  border-top: 1px solid #e4ded5;
  background: #faf8f4;
}

/* Narrow Teams widths: stack the nav above the content. */
@media (max-width: 720px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  .admin-nav-head { width: 100%; }
  .admin-nav-link { border-left: 0; border-radius: 6px; padding: 7px 10px; }
  .admin-nav-link.active { border-left: 0; }
}

/* Tech route-text editor — stacked labeled parts (intro/stop/pinned). */
.admin-template-field { margin-bottom: 12px; }
.admin-template-field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text, #1c1c1c);
  margin: 0 0 4px;
}

/* Inbound MMS media thumbnails + viewer (Monday #12122727563). */
.msg-media {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0;
}
.media-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border, #d0d0d0);
  border-radius: 8px;
  background: var(--surface-2, #f2f2f2);
  cursor: pointer;
  overflow: hidden;
  min-width: 64px;
  min-height: 48px;
}
.media-thumb-img {
  display: block;
  height: auto;
  border-radius: 7px;
}
.media-thumb-loading,
.media-thumb-error {
  cursor: default;
}
.media-thumb-spinner,
.media-thumb-error-text {
  font-size: 12px;
  color: var(--muted, #777);
  padding: 10px 12px;
}
.media-thumb-error {
  border-style: dashed;
}
.image-modal-body {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 80vh;
  overflow: auto;
}
.image-modal-img {
  max-width: 100%;
  max-height: 78vh;
  height: auto;
  border-radius: 6px;
}

/* =====================================================================
   Customers tab (#12122760694) — Filta palette, per-section cards.
   Scoped under .customers-root so it doesn't bleed into other tabs.
   ===================================================================== */
.customers-root {
  --filta-green: #7bba4c;
  --filta-blue: #2a86a6;
  --filta-blue-hover: #22708b;
  --filta-cream: #f8f5f1;
  --c-border: #e4ded5;
  --c-muted: #5f5f5f;
  --c-subtle: #8a8a8a;
  --c-green: #5a9433; --c-green-soft: #eef6e7;
  --c-amber: #b06a00; --c-amber-soft: #fff3dd;
  --c-red: #c8102e;   --c-red-soft: #fdecee;
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 18px;
  max-width: 1100px; margin: 0 auto;
}
.customers-root h2 { margin: 0; font-size: 15px; font-weight: 600; }
.cust-section-head p { margin: 3px 0 0; color: var(--c-muted); font-size: 12.5px; }
.cust-sub { color: var(--c-subtle); font-size: 12px; }

.cust-card, .cust-dash, .cust-narrow, .cust-unified {
  background: #fff; border: 1px solid var(--c-border); border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 1px 6px rgba(0,0,0,.04);
}
.cust-dash, .cust-narrow, .cust-unified { padding: 16px 18px; }
.cust-dash, .cust-narrow, .cust-unified { display: flex; flex-direction: column; gap: 14px; }
.cust-narrow:empty { display: none; }

/* KPIs */
.cust-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cust-kpi { border: 1px solid var(--c-border); border-radius: 10px; padding: 12px 14px; background: var(--filta-cream); }
.cust-kpi-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--c-subtle); font-weight: 700; }
.cust-kpi-num { font-size: 24px; font-weight: 700; margin-top: 4px; }
.cust-kpi-sub { font-size: 12px; color: var(--c-muted); margin-top: 2px; }
.cust-kpi.good .cust-kpi-num { color: var(--c-green); }
.cust-kpi.warn .cust-kpi-num { color: var(--c-amber); }

/* Bucket tabs */
.cust-bucket-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--c-border); }
.cust-bucket { background: none; border: none; padding: 10px 12px; font-size: 12.5px; font-weight: 600; color: var(--c-muted); cursor: pointer; border-bottom: 2px solid transparent; }
.cust-bucket.active { color: var(--filta-blue); border-bottom-color: var(--filta-blue); }
.cust-count { display: inline-block; background: var(--c-amber-soft); color: var(--c-amber); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: 4px; }
.cust-bucket.active .cust-count { background: #eaf3f7; color: var(--filta-blue); }

/* Tables */
.cust-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cust-table th { text-align: left; color: var(--c-subtle); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; padding: 9px 12px; border-bottom: 1px solid var(--c-border); background: var(--filta-cream); }
.cust-table td { padding: 11px 12px; border-bottom: 1px solid #f0efee; vertical-align: middle; }
.cust-drill, .cust-contact-row { cursor: pointer; }
.cust-drill:hover, .cust-contact-row:hover { background: #fafafa; }
.cust-contact-row.expanded { background: #fafcff; }

/* ---- Customers grid: density + 10-row scroll cap + filter row (#12243164771) ---- */
.cust-grid-wrap { display: flex; flex-direction: column; }
/* Cap the needs-attention grid to ~10 condensed rows; scroll the overflow
   in place rather than letting 700+ rows run the page off-screen. */
.cust-grid-scroll { max-height: 400px; overflow-y: auto; border: 1px solid var(--c-border); border-radius: 8px; }
.cust-table.cust-grid { border-collapse: separate; border-spacing: 0; }
/* Condensed rows (~36px) so 10 fit comfortably inside the scroll cap. */
.cust-table.cust-grid th { padding: 6px 12px; position: sticky; top: 0; z-index: 1; }
.cust-table.cust-grid td { padding: 7px 12px; }
.cust-table.cust-grid tr.cust-inactive-row { opacity: .62; }
.cust-table.cust-grid tr.cust-inactive-row:hover { opacity: 1; }

/* Scheduled-tab-style filter pane (#12243164771 rev 2) — mirrors the
   .scheduled-filter-* layout: horizontal label-over-control cells with the
   Reset button at the end, wrapping to a stacked layout on narrow widths.
   Filta palette on focus/hover, same as the rest of the tab. */
.cust-filter-pane { padding: 12px 0; margin: 8px 0 0; }
.cust-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin: 12px 0;
}
.cust-filter-cell {
  display: flex;
  flex-direction: column;
  flex: 1 1 160px;
  min-width: 140px;
}
.cust-filter-cell .compose-lbl { margin: 0 0 4px; }
.cust-filter-cell select,
.cust-filter-cell input[type="text"] {
  width: 100%;
  padding: 6px 8px;
  font: inherit;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  background: #fff;
}
.cust-filter-cell select:focus,
.cust-filter-cell input[type="text"]:focus {
  outline: none; border-color: var(--filta-blue); box-shadow: 0 0 0 2px rgba(42,134,166,.15);
}
@media (max-width: 640px) {
  .cust-filter-cell { flex: 1 1 100%; }
}

/* Unified header chrome (#12257944462): one card, one border — search row on
   top, bucket tabs in the middle, filter row + count below. The single Reset
   is pinned top-right; its active state lights up Filta green (never red)
   with a bolder weight and a small dot whenever search/bucket/filters are
   non-default, and falls back to the subtle ghost button at defaults. */
.cust-unified-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cust-unified-reset { height: 32px; white-space: nowrap; flex: 0 0 auto; }
.cust-unified-reset:hover { color: var(--filta-green); }
.cust-unified-reset.cust-reset-active {
  color: var(--filta-green);
  border-color: var(--filta-green);
  font-weight: 700;
  background: #f3f9ee;
}
.cust-unified-reset.cust-reset-active::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--filta-green);
  margin-right: 6px;
  vertical-align: 1px;
}

/* Search */
.cust-search-box { position: relative; max-width: 520px; }
.cust-search-input { width: 100%; font: inherit; font-size: 14px; border: 1px solid var(--c-border); border-radius: 8px; padding: 10px 12px; background: #fff; }
.cust-search-input:focus { outline: none; border-color: var(--filta-blue); box-shadow: 0 0 0 2px rgba(42,134,166,.15); }

/* Search row inside the unified header: input stretches the full card width
   (the heading lives in .cust-unified-head above it). */
.cust-search-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.cust-search-row .cust-search-box { flex: 1 1 260px; max-width: none; }
.cust-typeahead { position: absolute; left: 0; right: 0; top: 44px; background: #fff; border: 1px solid var(--c-border); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.08); z-index: 30; max-height: 280px; overflow-y: auto; }
.cust-typeahead:empty { display: none; }
.cust-ta-row { padding: 9px 14px; cursor: pointer; border-bottom: 1px solid #f3f0ea; }
.cust-ta-row:hover { background: #eaf3f7; }

/* Customer header */
.cust-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--c-border); background: linear-gradient(180deg,#eef6e7 0%, var(--filta-cream) 100%); }
.cust-avatar { width: 42px; height: 42px; border-radius: 8px; background: var(--filta-green); color: #fff; font-weight: 700; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.cust-meta h2 { font-size: 16px; }
.cust-head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
/* Tech / Day header labels (#12258598659). cust-head-main holds the
   name/subtitle plus the schedule labels; flex-wrap means a long
   name + many techs/days wraps the labels to a second row UNDER the
   name/subtitle instead of truncating or pushing into the actions. */
.cust-head-main { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 28px; }
.cust-sched { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; min-width: 0; }
.cust-sched-item { font-size: 12.5px; color: var(--c-text, #2d3a30); }
.cust-sched-k { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--c-subtle); margin-right: 6px; }

/* Pills */
.customers-root .pill.cust-primary { background: #eaf3f7; color: var(--filta-blue); margin-left: 6px; }
.customers-root .pill.cust-on { background: var(--c-green-soft); color: var(--c-green); }
.customers-root .pill.cust-off { background: var(--c-amber-soft); color: var(--c-amber); }
.customers-root .pill.cust-stop { background: var(--c-red-soft); color: var(--c-red); }

/* Edit drawer */
.cust-edit-drawer { padding: 16px 18px; background: #fafcff; border-bottom: 1px solid var(--c-border); }
.cust-edit-title { margin: 0 0 12px; font-size: 14px; }
.cust-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.cust-field { display: flex; flex-direction: column; }
.cust-field.full { grid-column: span 2; }
.cust-field label { font-size: 12px; font-weight: 600; color: var(--c-muted); margin-bottom: 5px; }
.cust-field input, .cust-field select, .cust-field textarea { font: inherit; font-size: 13px; border: 1px solid var(--c-border); border-radius: 6px; padding: 8px 11px; background: #fff; }
.cust-field input:focus, .cust-field select:focus, .cust-field textarea:focus { outline: none; border-color: var(--filta-blue); box-shadow: 0 0 0 2px rgba(42,134,166,.15); }
.cust-field textarea { min-height: 60px; resize: vertical; }

.cust-toggle-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--filta-cream); border: 1px solid var(--c-border); border-radius: 8px; }
.cust-toggle { position: relative; width: 38px; height: 22px; background: #ccc; border-radius: 999px; cursor: pointer; flex-shrink: 0; }
.cust-knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; }
.cust-toggle.on { background: var(--filta-blue); }
.cust-toggle.on .cust-knob { left: 18px; }
.cust-warn { font-size: 11.5px; color: var(--c-amber); background: var(--c-amber-soft); padding: 4px 8px; border-radius: 6px; margin-left: auto; }

.cust-actions { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.cust-save-status { font-size: 12px; color: var(--c-muted); }

.cust-dup { margin-top: 12px; border: 1px solid #f1c878; background: #fff7e6; border-radius: 8px; padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; }
.cust-dup-icon { font-size: 20px; line-height: 1; }
.cust-dup h4 { margin: 0 0 4px; font-size: 13px; color: var(--c-amber); }
.cust-dup p { margin: 0; font-size: 12.5px; }

.cust-empty { padding: 22px 14px; text-align: center; color: var(--c-muted); font-size: 13px; }
.cust-empty.error { color: var(--c-red); }
.cust-confirm-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* Active/Inactive filter — Show inactive toggle + inactive list */
.cust-inactive-toggle { margin-top: 12px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--c-muted); background: #fff; border: 1px solid var(--c-border); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.cust-inactive-toggle:hover { border-color: var(--filta-blue); color: var(--filta-blue); }
.cust-inactive-toggle.on { background: var(--filta-cream); border-color: var(--filta-blue); color: var(--filta-blue); }
.cust-inactive-area { margin-top: 12px; }
.cust-inactive-head h3 { margin: 0; font-size: 14px; }
.customers-root .pill.cust-inactive-pill { background: var(--c-amber-soft); color: var(--c-amber); margin-left: 6px; }
/* "No route" = non-crosswalk Nutshell account (#316) — gray, deliberately
   distinct from the amber Inactive pill so staff can see the row is outside
   the operational book entirely. */
.customers-root .pill.cust-noroute-pill { background: #f0f0f0; color: #616161; margin-left: 6px; }
/* "Show all (N)" toggle cell in the unified filter header. flex: 0 0 auto
   (#320): size to content and never shrink — combined with the row's
   flex-wrap, the toggle wraps whole onto its own line when the row is tight
   instead of overlapping the Day select. */
.cust-show-all-cell { display: flex; align-items: flex-end; flex: 0 0 auto; min-width: auto; }
.cust-show-all-lbl { display: flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.cust-show-all-box { margin: 0; }
.cust-inactive-table tr.cust-inactive-row { opacity: .62; }
.cust-inactive-table tr.cust-inactive-row:hover { opacity: 1; }

/* ---- Customers tab: SMS required-field warnings (#12241776759) ---- */
.customers-root .cust-required-caption { font-size: 11px; color: var(--c-subtle); margin-top: 4px; }
.customers-root .cust-required-caption.warn { color: var(--c-amber); }
.customers-root .cust-field input.cust-required-warn,
.customers-root .cust-field select.cust-required-warn { border-color: #d9a441; background: #fffdf8; }
.customers-root .cust-field input.cust-required-warn:focus,
.customers-root .cust-field select.cust-required-warn:focus { border-color: #d9a441; box-shadow: 0 0 0 2px rgba(217,164,65,.18); }
.customers-root .cust-banner-missing-info {
  background: #fbf5e8;            /* cream base, faint amber tint */
  color: #8b5a00;                 /* dark amber, accessible on cream */
  border: 1px solid #e8d3a4;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
}

/* --- Reference #211 — Compose send-time confirmation modal --- */
/* The dialog itself reuses .modal-backdrop / .modal-dialog. The phone
   mockup is deliberately UN-branded — it should read as "a customer's
   phone", not as AFS UI. iOS-style incoming (gray) bubbles. */
.compose-sendconfirm-dialog {
  width: min(440px, 94%);
}
.compose-sendconfirm-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.compose-sms-mockup {
  width: 270px;
  border: 9px solid #1c1c1e;
  border-radius: 34px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
}
.compose-sms-mockup-header {
  background: #f6f6f8;
  border-bottom: 1px solid #e2e2e6;
  text-align: center;
  padding: 12px 8px 8px;
}
.compose-sms-mockup-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #8e8e93;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  line-height: 34px;
  text-align: center;
  margin: 0 auto 3px;
}
.compose-sms-mockup-name {
  font-size: 12px;
  font-weight: 600;
  color: #1c1c1e;
}
.compose-sms-mockup-number {
  font-size: 10px;
  color: #8e8e93;
}
.compose-sms-mockup-screen {
  background: #fff;
  padding: 12px 10px 16px;
  min-height: 130px;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}
.compose-sms-mockup-ts {
  font-size: 10px;
  color: #8e8e93;
  align-self: center;
  margin-bottom: 3px;
}
.compose-sms-mockup-bubble {
  background: #e9e9eb;
  color: #000;
  border-radius: 18px;
  padding: 7px 12px;
  font-size: 13px;
  line-height: 1.35;
  max-width: 88%;
  white-space: pre-wrap;
  word-break: break-word;
}
.compose-sms-mockup-splitnote {
  font-size: 10px;
  color: #b3540a;
  align-self: center;
  margin-top: 4px;
}
.compose-sendconfirm-caption {
  font-size: 12px;
  color: var(--color-text-muted);
  margin: 0;
  text-align: center;
}
.compose-sendconfirm-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.compose-sendconfirm-nav-btn {
  border: 1px solid #d8dee9;
  background: #fff;
  border-radius: 6px;
  width: 30px;
  height: 26px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text);
}
.compose-sendconfirm-nav-btn:hover { background: #f5f7fb; }
.compose-sendconfirm-pos {
  font-size: 12px;
  color: var(--color-text-muted);
  min-width: 110px;
  text-align: center;
}
.compose-sendconfirm-summary {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  text-align: center;
}
.compose-sendconfirm-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

/* --- Customers tab: intro video link + modal (Monday #12246375401) ---
   Header affordance: "Intro video ↗" link with a hover-revealed edit pencil,
   or "+ Add intro video" when the account field is empty. Filta palette via
   the existing button classes; only the reveal + modal input are new. */
.cust-video-wrap { position: relative; display: inline-flex; align-items: center; gap: 2px; }
.cust-video-edit {
  opacity: 0;
  transition: opacity 120ms ease;
  padding: 4px 6px;
  font-size: 13px;
  line-height: 1;
}
.cust-video-wrap:hover .cust-video-edit,
.cust-video-edit:focus,
.cust-video-edit:focus-visible { opacity: 1; }
.cust-video-dialog { max-width: 440px; }
.cust-video-input {
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border, #d9d4cc);
  border-radius: 6px;
  font-size: 14px;
}
.cust-video-input:focus { outline: 2px solid #2a86a6; outline-offset: 0; }
.cust-video-error { color: #b3261e; font-size: 12.5px; margin-top: 6px; }
.cust-video-remove { margin-right: auto; color: #b3261e; }

/* ===== Inbox per-user read/unread state (Monday #321) ===== */

/* Tab badge — small unread-count pill anchored top-right of a nav icon.
   The .tab is the positioning context; the pill floats over the icon. */
.tab { position: relative; }
.tab-badge {
  position: absolute;
  top: 6px;
  left: 50%;
  margin-left: 4px;            /* nudge to the icon's top-right */
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  box-sizing: border-box;
  border-radius: 8px;
  background: #7bba4c;          /* Filta green */
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
}
.tab-badge[hidden] { display: none; }

/* Per-user unread row — subtle Filta-green accent + weight, NOT red (the red
   dot stays reserved for the needs-reply heuristic, .thread-unread). */
.thread-item.thread-unread-user {
  background: rgba(123, 186, 76, 0.07);
  box-shadow: inset 3px 0 0 #7bba4c;
}
.thread-item.thread-unread-user .thread-name { font-weight: 700; }
.thread-item.thread-unread-user.active {
  /* active selection keeps its purple left bar; drop the green inset so the
     two accents don't fight. */
  box-shadow: none;
}

/* In-app right-click menu (Teams blocks the native contextmenu). Anchored at
   the click coordinates by inline left/top; backdrop catches outside clicks. */
.inbox-ctx-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: transparent;
}
.inbox-ctx-menu {
  position: fixed;
  min-width: 150px;
  background: var(--color-bg-app);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  padding: 4px;
  z-index: 1001;
}
.inbox-ctx-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 4px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
}
.inbox-ctx-item:hover { background: var(--color-bg-tab-active); }
.inbox-ctx-item:focus-visible { outline: 2px solid #2a86a6; outline-offset: -2px; }
