:root {
  --bg: #0a0a0f;
  --panel: #101018;
  --panel-2: #14141e;
  --border: rgba(255,255,255,0.08);
  --text: #e8e8ee;
  --text-muted: #8b8b9a;
  /* Accent/highlight updated to Morris Strategies brand (2026-09-26):
     Tertiary (#709DB8) replaces the old violet (#7b7bf5) as the primary
     accent everywhere — buttons, links, active states, outbound message
     bubbles. Color 4 (#D6E0E8) is a new lighter highlight variable for
     hover/emphasis moments that want extra pop against the dark base.
     The dark base itself (bg/panel/text/status colors) is unchanged —
     this is only the accent swap, keeping the original feel intact. */
  --accent: #709db8;
  --accent-soft: rgba(112,157,184,0.18);
  --highlight: #d6e0e8;
  --highlight-soft: rgba(214,224,232,0.14);
  --danger: #e0654f;
  --danger-soft: rgba(224,101,79,0.15);
  --positive: #4ade80;
  --positive-soft: rgba(74,222,128,0.15);
  --followup: #d4a94a;
  --followup-soft: rgba(212,169,74,0.18);
  --longfu: #e0764f;
  --longfu-soft: rgba(224,118,79,0.15);
  --results: #6b7280;
  --results-soft: rgba(107,114,128,0.2);
  --negative: #e0654f;
  --negative-soft: rgba(224,101,79,0.15);
  --unread: #709db8;
  --unread-soft: rgba(112,157,184,0.2);
  --checkresults: #4a9fd4;
  --checkresults-soft: rgba(74,159,212,0.15);
  --respond: #d4a94a;
  --respond-soft: rgba(212,169,74,0.18);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; }

.hidden { display: none !important; }

/* ---------- Login ---------- */
/* The sign-in and new-password screens use the Performance page's light
   colors, with "Powered by" and the Morris Strategies logo in the bottom-right corner. */
.login-screen {
  color-scheme: light;
  --bg: #f3f5f8; --panel: #ffffff; --panel-2: #f3f5f8; --border: #d8e0e7; --field-border: #c6cfd7;
  --text: #121d36; --text-muted: #5b6571; --accent: #709db8; --accent-ink: #33627f; --navy: #121d36; --danger: #c2264f;
  position: relative; min-height: 100vh; padding: 24px 16px 88px; display: flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--text);
}
.login-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 32px;
  width: 352px; max-width: 100%; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 1px 2px rgba(18,29,54,0.05), 0 12px 32px rgba(18,29,54,0.08);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 5px; color: var(--text); font-size: 15px; line-height: 1.3; }
/* A true rounded square whatever the title's length. */
.login-brand .logo-mark {
  flex: 0 0 36px; width: 36px; height: 36px; aspect-ratio: 1 / 1; border-radius: 9px; background: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 16px; overflow: hidden; padding: 0;
}
.login-card h1 { font-size: 17px; margin: 0; }
.login-sub { color: var(--text-muted); font-size: 13px; margin: 0 0 6px; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--text-muted); }
.login-card input, .login-card select {
  font: inherit; font-size: 14px; padding: 10px 12px; border: 1px solid var(--field-border); border-radius: 8px;
  background: var(--panel); color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus, .login-card select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(112,157,184,0.25); }
.login-card .btn { padding: 11px 14px; font-size: 14px; font-weight: 600; border-radius: 8px; }
.login-card .btn-primary { background: var(--navy); color: #fff; margin-top: 4px; }
.login-card .btn-primary:hover { opacity: 1; background: #1e2d4f; }
.login-card .btn-primary:focus-visible { outline: 3px solid rgba(112,157,184,0.5); outline-offset: 2px; }
.login-card .btn-secondary { background: var(--panel); color: var(--text); border: 1px solid var(--field-border); }
.login-error { color: var(--danger); font-size: 12.5px; margin: 0; }
/* A ring of brand colour that runs around the sign-in card on a loop:
   pale #D6E0E8 most of the way, brightening through #95A0A5 and #709DB8
   to the navy #0F1D38 at its head, with a soft glow following it. Browsers
   that can't animate it show the same ring standing still; anyone who has
   asked for reduced motion gets it still too. */
@property --ring-angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.login-card {
  --ring: conic-gradient(from var(--ring-angle), #d6e0e8 0deg, #d6e0e8 180deg, #95a0a5 235deg, #709db8 290deg, #0f1d38 338deg, #d6e0e8 360deg);
  position: relative; border: 2px solid transparent;
  background: linear-gradient(var(--panel), var(--panel)) padding-box, var(--ring) border-box;
  animation: ring-run 9s linear infinite;
}
.login-card::before {
  content: ""; position: absolute; inset: -2px; z-index: -1; border-radius: inherit; pointer-events: none;
  background: var(--ring); filter: blur(14px); opacity: .28;
  animation: ring-run 9s linear infinite;
}
@keyframes ring-run { to { --ring-angle: 360deg; } }
/* The glow sits behind the card but in front of the page background. */
.login-screen { isolation: isolate; }
@media (prefers-reduced-motion: reduce) {
  .login-card, .login-card::before { animation: none; }
}
/* A link to the Morris Strategies site. The logo is built into this file,
   so there's no separate image to upload. */
.ms-stamp {
  position: absolute; right: 18px; bottom: 16px; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px;
  color: var(--text-muted); font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  text-decoration: none; opacity: .9; transition: background-color .15s, opacity .15s;
}
.ms-stamp:hover { opacity: 1; background: rgba(18,29,54,0.05); }
.ms-stamp:focus-visible { outline: 3px solid rgba(112,157,184,0.5); outline-offset: 2px; }
.ms-stamp span { white-space: nowrap; }
.ms-stamp .ms-logo {
  display: block; height: 30px; width: 129px;
  background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAABGCAMAAABBu1nPAAAAYFBMVEUaU2oXQGkdKmcXQWsAVaoVQGcA/wBVVVUAAAAWPWQXQWoAVVUVPWUUPWUVPWUVPWQAf38VPWUVPGQIPHEAAH8APj4AAP8UQWYUO1sRRGcUO14SRFgDKlUWQGcA//8AAFWzfZGUAAAAIHRSTlMGoQbDA28BAwD7/gPNMY5xArFNCwIEASsMEyUNB08BA0dCmQUAAA74SURBVHja7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usPPgAUZuDTtTMmfg6XtKmYy8fgrPWXKMu3OEBlJfWR6m9WUCP0SWPHrODRnczDVRAUsP+xXmH59A9uhZUOSRjsAK0nTF17QRaPUfkzC2VlVsOCDFXdTi9Gji/aTU5Fa+6kjsIbEBDCg+I1LQ5/HpkMfvRiyalMWvm3Tv7KzSBZGLt98ugaWDYEJhroXwPJvuWVR/GiDdOgFfO6D4UjIGZkF6DuZVQXrkZoveLvbqK2B5+cZsNAFlP3llKtggR4E91ii0E+Jsuz3X8Ar5UjTBMOeyWMBLzewAeSCtOGq1EuwZIOHQdYQrBP9x0eywSOwQuqLbUW+uhp1UIo2esZDsIQTUrgOpWPed8u+W1M1HSjSowMszem61MHypgNO2sJ2bzeZCOtDsHwqsS867OfBgu+ouWP16LxFsNRNSYAhVNoKVFusCSW8/jNsaD7D45eug/XINzz4IooxEZPHYBkhX7sQf8WRBuoAsaOdFra+tLMs+7gdGB1omqT35HLDR5uDNQrXPGocbBZw84x2qfmG6TBlXUP4KNKQel2NqUXq2IE5WfuIiLfEutcfsFHGi7efTusTbZgMXlsL1gLlZgMwhSmq7SM+Uzfd+GvTIRYcEPLLLg1mi/s4obL0zUvDwt0mP2bFpoOpq/nxVg/ajc/KTz/J+MOI4zMya4bbjvBRPonnlhPDYDXTD3/b4v7GoGqI6zUGROj3t6mPVP/jLQEr3qd7G9EX/CTcG2RTNAzMuqHuVJaGPQVcb2FDWtP0DyM4J2P32p0sAAAAAElFTkSuQmCC") center / contain no-repeat;
}
@media (max-width: 520px) {
  .login-card { padding: 26px 22px; }
  /* 16px stops a phone from zooming in when a field is tapped. */
  .login-card input, .login-card select { font-size: 16px; }
  .ms-stamp { right: 50%; transform: translateX(50%); bottom: 14px; }
  .ms-stamp .ms-logo { height: 24px; width: 103px; }
}

/* ---------- Shell ---------- */
.app { height: 100vh; display: flex; flex-direction: column; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--panel); flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 14px; flex-shrink: 0; overflow: hidden; padding: 0; }
.brand-text .brand-name { font-weight: 600; font-size: 14px; line-height: 1.2; }
.brand-text .brand-sub { font-size: 11px; color: var(--text-muted); line-height: 1.2; }

.btn { border: none; border-radius: 8px; padding: 8px 14px; font: inherit; cursor: pointer; transition: opacity .15s; }
.btn:hover { opacity: 0.88; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.btn-secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.icon-btn { background: none; border: none; font-size: 17px; cursor: pointer; color: var(--text-muted); }
.icon-btn:hover { color: var(--text); }

.layout { flex: 1; display: grid; grid-template-columns: 240px 320px 1fr; min-height: 0; }
.layout.client-view { grid-template-columns: 340px 1fr; }
.layout.client-view .accounts-pane { display: none; }

.pane { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; background: var(--panel); }
.thread-pane { border-right: none; background: var(--bg); }
.chats-pane { background: var(--bg); }

/* ---------- Accounts sidebar ---------- */
.accounts-pane { padding: 14px 12px; gap: 4px; overflow-y: auto; }
.sidebar-section-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); padding: 12px 8px 6px; display: flex; justify-content: space-between; align-items: center; }
.sidebar-section-label .add-btn { cursor: pointer; color: var(--text-muted); font-size: 15px; }
.sidebar-section-label .add-btn:hover { color: var(--text); }
.sidebar-section-label .label-actions { display: flex; align-items: center; gap: 12px; }

.account-list, .pending-account-list { list-style: none; margin: 0; padding: 0; }
.all-accounts-row, .account-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text);
}
.all-accounts-row:hover, .account-row:hover { background: var(--panel-2); }
.all-accounts-row.active, .account-row.active { background: var(--accent-soft); }
.all-accounts-row .left, .account-row .left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--text-muted); }
.status-dot.blue { background: #7b93f5; }
.status-dot.amber { background: #d4a94a; }
.status-dot.green { background: #4ade80; }
.status-dot.violet { background: #a78bfa; }
.status-dot.rose { background: #f472b6; }
.status-dot.teal { background: #2dd4bf; }
.account-row .name, .all-accounts-row .name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread-badge { background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; border-radius: 999px; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; padding: 0 5px; flex-shrink: 0; }
.pending-account-list .account-row { flex-direction: column; align-items: stretch; cursor: default; }
.pending-account-list .owner { font-size: 11px; color: var(--text-muted); margin: 2px 0 6px; }
.pending-account-list .actions button { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 5px 10px; font-size: 12px; cursor: pointer; }

/* ---------- Conversations list ---------- */
.chats-pane-header { padding: 14px 16px 10px; }
.chats-pane-header h2 { font-size: 15px; margin: 0 0 10px; }
.search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.search-input-wrap { flex: 1; position: relative; }
.search-input-wrap input { width: 100%; padding: 8px 10px 8px 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font: inherit; }
.search-input-wrap::before { content: "⌕"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; }
.unread-toggle { border: 1px solid var(--border); background: var(--panel-2); color: var(--text-muted); border-radius: 8px; padding: 8px 12px; font: inherit; font-size: 12px; cursor: pointer; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.unread-toggle .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.unread-toggle.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

.status-filter-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; }
.status-pill { border: 1px solid var(--border); background: var(--panel-2); color: var(--text-muted); border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 500; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.status-pill.active { border-color: transparent; }
.status-pill[data-status="all"].active { background: var(--panel-2); color: var(--text); border-color: var(--text-muted); }
.status-pill[data-status="positive_response"] { color: var(--positive); }
.status-pill[data-status="positive_response"].active { background: var(--positive-soft); }
.status-pill[data-status="long_follow_up"] { color: var(--longfu); }
.status-pill[data-status="long_follow_up"].active { background: var(--longfu-soft); }
.status-pill[data-status="results"] { color: var(--results); }
.status-pill[data-status="results"].active { background: var(--results-soft); }
.status-pill[data-status="negative_response"] { color: var(--negative); }
.status-pill[data-status="negative_response"].active { background: var(--negative-soft); }
.status-pill[data-status="unread"] { color: var(--unread); }
.status-pill[data-status="unread"].active { background: var(--unread-soft); }
.status-pill[data-status="check_results"] { color: var(--checkresults); }
.status-pill[data-status="check_results"].active { background: var(--checkresults-soft); }
.status-pill[data-status="respond"] { color: var(--respond); }
.status-pill[data-status="respond"].active { background: var(--respond-soft); }

.chat-list { list-style: none; margin: 0; padding: 0 8px 8px; overflow-y: auto; flex: 1; }
.chat-row { display: flex; gap: 10px; padding: 10px 8px; border-radius: 10px; cursor: pointer; position: relative; align-items: center; }
.chat-row:hover { background: var(--panel-2); }
.chat-row.active { background: var(--accent-soft); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: #fff; flex-shrink: 0; }
.avatar.blue { background: #4a5bc9; }
.avatar.amber { background: #a8752e; }
.avatar.green { background: #2d8a5f; }
.avatar.violet { background: #6d4fc4; }
.avatar.rose { background: #c94f8a; }
.avatar.teal { background: #1f9e8f; }
.chat-row-body { flex: 1; min-width: 0; }
.chat-row-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.chat-row-top .name { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.chat-row-top .name .unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.chat-row-top .time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.chat-row .snippet { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 2px 0 6px; }
.chat-row .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 10.5px; font-weight: 600; border-radius: 5px; padding: 2px 7px; }
.tag.owner-tag { background: var(--panel-2); color: var(--text-muted); }
.tag.positive_response { background: var(--positive-soft); color: var(--positive); }
.tag.long_follow_up { background: var(--longfu-soft); color: var(--longfu); }
.tag.results { background: var(--results-soft); color: var(--results); }
.tag.negative_response { background: var(--negative-soft); color: var(--negative); }
.tag.unread { background: var(--unread-soft); color: var(--unread); }
.tag.check_results { background: var(--checkresults-soft); color: var(--checkresults); }
.tag.respond { background: var(--respond-soft); color: var(--respond); }

/* Per-row delete icon — hidden until hover so the list doesn't look
   cluttered by default. */
.chat-row-delete {
  opacity: 0;
  transition: opacity .15s;
  flex-shrink: 0;
  font-size: 15px;
}
.chat-row:hover .chat-row-delete {
  opacity: 0.55;
}
.chat-row-delete:hover {
  opacity: 1 !important;
}

/* ---------- Thread ---------- */
.thread-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.thread-header .avatar { width: 40px; height: 40px; font-size: 14px; }
.thread-header .who .name { font-weight: 600; font-size: 15px; }
.thread-header .who .name a { color: inherit; text-decoration: none; }
.thread-header .who .name a:hover { text-decoration: underline; }
.thread-header .who .sub { font-size: 12px; color: var(--text-muted); }

.thread-header-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.thread-header-actions .icon-btn {
  font-size: 15px;
}

.mark-as-row { padding: 10px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mark-as-row .label { font-size: 12px; color: var(--text-muted); margin-right: 4px; }
.mark-as-btn { border: 1px solid var(--border); background: var(--panel-2); color: var(--text-muted); border-radius: 999px; padding: 6px 13px; font-size: 12px; font-weight: 500; cursor: pointer; }
.mark-as-btn[data-status="positive_response"].active { background: var(--positive-soft); color: var(--positive); border-color: transparent; }
.mark-as-btn[data-status="long_follow_up"].active { background: var(--longfu-soft); color: var(--longfu); border-color: transparent; }
.mark-as-btn[data-status="results"].active { background: var(--results-soft); color: var(--results); border-color: transparent; }
.mark-as-btn[data-status="negative_response"].active { background: var(--negative-soft); color: var(--negative); border-color: transparent; }
.mark-as-btn[data-status="unread"].active { background: var(--unread-soft); color: var(--unread); border-color: transparent; }
.mark-as-btn[data-status="check_results"].active { background: var(--checkresults-soft); color: var(--checkresults); border-color: transparent; }
.mark-as-btn[data-status="respond"].active { background: var(--respond-soft); color: var(--respond); border-color: transparent; }


.thread-messages { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 60%; padding: 9px 13px; border-radius: 12px; font-size: 13px; }
.msg.in { align-self: flex-start; background: var(--panel-2); }
.msg.out { align-self: flex-end; background: var(--accent); color: #fff; }
.msg .meta { font-size: 10.5px; opacity: .6; margin-top: 4px; }
/* Voice notes, photos and files inside a message bubble */
.msg > div:not(.meta) + .msg-attachment { margin-top: 6px; }
.msg audio { display: block; width: 280px; max-width: 100%; height: 36px; }
.msg-note { font-size: 12.5px; font-style: italic; opacity: .8; }
.msg-note a, .msg-file-link { color: inherit; text-decoration: underline; }

.reply-form { display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); flex-shrink: 0; }
.reply-form textarea { flex: 1; resize: none; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font: inherit; background: var(--panel-2); color: var(--text); }
.reply-form textarea::placeholder { color: var(--text-muted); }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--danger); color: var(--danger); padding: 10px 16px; border-radius: 8px; font-size: 13px; max-width: 480px; text-align: center; z-index: 50; }

/* ---------- Modals ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 40; }
.modal-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; width: 420px; max-width: 92vw; overflow: hidden; max-height: 85vh; display: flex; flex-direction: column; }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 20px 4px; }
.modal-header .titles h2 { font-size: 17px; margin: 0 0 4px; }
.modal-header .titles p { font-size: 12.5px; color: var(--text-muted); margin: 0; max-width: 320px; }
.modal-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.modal-body label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--text); }
.modal-body input, .modal-body select { font: inherit; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); color: var(--text); }
.modal-note { font-size: 11px; color: var(--text-muted); margin: 0; }
.modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.modal-actions .btn { flex: 1; }
.connected-accounts-list { list-style: none; margin: 14px 0 0; padding: 14px 0 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; max-height: 160px; overflow-y: auto; }
.connected-accounts-list .label { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); margin-bottom: 2px; }
.connected-accounts-list li { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.connected-accounts-list .remove-link { color: var(--danger); background: none; border: none; font-size: 12px; cursor: pointer; }

.users-list { list-style: none; margin: 0 0 12px; padding: 0; max-height: 200px; overflow-y: auto; }
.users-list li { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.users-list .role-tag { font-size: 11px; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 1px 6px; margin-left: 6px; white-space: nowrap; }
/* Room for Move / Reset password / Sign out / Remove on one line */
#usersModal .modal-card { width: 560px; }
.users-list li { gap: 12px; }
.users-list li > span:last-child { flex-shrink: 0; }
.users-list button { white-space: nowrap; }
#createUserForm { display: flex; flex-direction: column; gap: 12px; }
#createUserForm label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--text); }
#createUserForm input, #createUserForm select { font: inherit; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); color: var(--text); }

/* ---------- Manage Clients modal ---------- */
.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover {
  text-decoration: underline;
}

/* ---------- Logo image inside the badge (replaces the "R" text mark) ----------
   Fixed pixel dimensions matching each .logo-mark container exactly,
   rather than width/height:100%, since percentage sizing on an <img>
   inside a flex container was stretching it unevenly. object-fit: cover
   keeps the crop centered and undistorted regardless of the source
   image's exact aspect ratio. */
.login-brand .logo-mark .logo-img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}
.brand .logo-mark .logo-img {
  width: 30px;
  height: 30px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

/* ---------- Highlight utility (Color 4) ----------
   Available for any element that wants the lighter brand highlight
   rather than the main accent — e.g. a subtle glow, an active border,
   or emphasis text against the dark base. Not applied anywhere by
   default; use var(--highlight) / var(--highlight-soft) where wanted. */
.highlight-text { color: var(--highlight); }
.highlight-border { border-color: var(--highlight) !important; }

/* Admin banner above the conversation list when the leads-only rule can't fully run */
.leads-banner { margin: 0 16px 10px; padding: 10px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.45;
  background: var(--followup-soft); border: 1px solid var(--followup); color: var(--text); }
.leads-banner.error { background: var(--danger-soft); border-color: var(--danger); }
.leads-banner ul { margin: 6px 0 0; padding-left: 18px; color: var(--text-muted); }
.leads-banner li + li { margin-top: 4px; }

/* The lead's company, from the client's Airtable leads table, shown after
   the contact's name in the conversation header. */
.thread-header .name .lead-company { margin-left: 10px; font-weight: 500; font-size: 14px; color: var(--text-muted); }


/* ============================================================
   Phones and small tablets (820px and under)
   ------------------------------------------------------------
   Everything below lives inside a media query, so the desktop
   layout is byte-for-byte unchanged. On a narrow screen the three
   side-by-side panes become one at a time, the way a phone mail
   app works: conversations by default, the thread when you tap
   one, the accounts sidebar behind the menu button.
   ============================================================ */

.mobile-only { display: none; }

@media (max-width: 820px) {
  .mobile-only { display: inline-flex; }

  /* 100vh is wrong on mobile browsers (it ignores the address bar),
     so use the dynamic viewport height where it's supported. */
  .app { height: 100vh; height: 100dvh; }

  /* Keep content clear of the notch and the home bar. */
  .topbar { padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); gap: 8px; }
  /* Keep the name (it carries the client's own branding) but on one line,
     trimmed with an ellipsis, and drop the tagline underneath. */
  .topbar { position: relative; }
  .brand { min-width: 0; flex: 1; }
  .brand-text { min-width: 0; }
  .brand-text .brand-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brand-text .brand-sub { display: none; }

  /* One pane at a time. */
  .layout, .layout.client-view { grid-template-columns: 1fr; }
  /* A grid column sizes itself to its content unless told otherwise, so
     without this the sideways-scrolling filter pills stretch the whole
     pane wider than the screen. */
  .pane, .chats-pane-header, .search-row, .status-filter-row, .mark-as-row, .thread-messages { min-width: 0; }
  .pane { border-right: none; }
  .accounts-pane, .chats-pane, .thread-pane { display: none; }
  .layout.mobile-view-accounts .accounts-pane { display: flex; }
  .layout.mobile-view-chats .chats-pane { display: flex; }
  .layout.mobile-view-thread .thread-pane { display: flex; }
  /* A client login has no accounts pane, so it has no menu button. */
  .layout.client-view .accounts-pane { display: none; }
  .client-view ~ * #mobileMenuBtn, body.client-login #mobileMenuBtn { display: none; }

  .mobile-thread-bar { padding: 10px 12px 0; }
  .mobile-thread-bar .link-btn { font-size: 14px; padding: 6px 0; }

  /* Bigger tap targets throughout. */
  .chat-row { padding: 12px; gap: 10px; }
  .chat-row .avatar { width: 40px; height: 40px; }
  .chat-row .name { font-size: 14.5px; }
  .chat-row .snippet { font-size: 13px; }
  .chat-row-delete { opacity: 1; }

  .chats-pane-header { padding: 10px 12px; }
  .search-row { gap: 8px; }
  .search-row input { font-size: 16px; } /* 16px stops iOS zooming in on focus */

  /* Filter pills scroll sideways instead of wrapping into a tall block. */
  .status-filter-row {
    display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 8px;
    padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .status-filter-row::-webkit-scrollbar { display: none; }
  .status-pill { flex: 0 0 auto; padding: 7px 12px; font-size: 13px; white-space: nowrap; }
  .mark-as-row .label { flex: 0 0 auto; }

  .mark-as-row { flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding: 10px 12px; scrollbar-width: none; }
  .mark-as-row::-webkit-scrollbar { display: none; }
  .mark-as-row .status-pill { flex: 0 0 auto; }

  .thread-header { padding: 12px; gap: 10px; }
  .thread-header .avatar { width: 36px; height: 36px; }
  .thread-header .name .lead-company { margin-left: 6px; font-size: 13px; }

  /* Message bubbles can use far more of a narrow screen. */
  .thread-messages { padding: 12px; gap: 8px; }
  .msg { max-width: 85%; font-size: 14px; }
  .msg audio { width: 100%; }

  /* Reply box: comfortable to type in, clear of the home bar. */
  .reply-form { padding: 10px 12px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); gap: 8px; }
  .reply-form textarea { font-size: 16px; min-height: 48px; }
  .reply-form button { padding: 12px 16px; }

  /* Dialogs fill the screen rather than floating in a tiny box. */
  .modal { padding: 16px; }
  .modal-card { width: 100%; max-width: none; max-height: 85vh; overflow-y: auto; }

  .leads-banner { margin: 0 12px 8px; }
}

/* Very narrow phones */
@media (max-width: 380px) {
  .brand-text .brand-name { font-size: 13px; }
}

/* Editing, deleting and reacting to a message */
.msg { position: relative; }
.msg-actions {
  position: absolute; top: -10px; right: 8px; display: none; gap: 4px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 2px;
}
.msg:hover .msg-actions { display: flex; }
.msg-action {
  /* Same white as a contact's name, so the options read clearly against
     the dark bubble instead of fading into it. */
  background: none; border: none; color: var(--text); cursor: pointer;
  font-size: 12.5px; font-weight: 500; padding: 4px 8px; border-radius: 6px;
  line-height: 1.2;
}
/* The react button is an emoji on its own, so it needs more size than the
   word buttons beside it to feel like an equal target. */
.msg-action[data-act="react"] { font-size: 17px; padding: 2px 8px; }
.msg-action:hover { background: var(--panel-2); }
.msg-reaction {
  position: absolute; bottom: -10px; left: 10px; font-size: 13px; line-height: 1;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 2px 6px;
}
/* Sits inside the bubble rather than floating above it: a floating picker
   was clipped by the scrolling thread and could end up behind the
   "Mark as" row, where it couldn't be clicked. */
.emoji-picker {
  display: flex; gap: 2px; margin-top: 6px; padding: 4px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
}
.emoji-choice { background: none; border: none; cursor: pointer; font-size: 17px; padding: 3px 5px; border-radius: 6px; line-height: 1; }
.emoji-choice:hover { background: var(--panel-2); }
.msg-edit { display: flex; flex-direction: column; gap: 6px; min-width: 240px; }
.msg-edit-text {
  width: 100%; min-height: 64px; resize: vertical; font: inherit; font-size: 13px;
  background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px;
}
.msg-edit-buttons { display: flex; gap: 6px; justify-content: flex-end; }
.msg-edit-buttons .btn { padding: 5px 10px; font-size: 12px; }

@media (max-width: 820px) {
  /* No hover on a touchscreen, so the buttons stay visible. */
  .msg-actions { display: flex; position: static; margin-top: 6px; justify-content: flex-end; background: none; border: none; padding: 0; }
  .msg-action { font-size: 12.5px; padding: 5px 8px; background: var(--panel); border: 1px solid var(--border); color: var(--text); }
  .msg-edit { min-width: 0; }
  .msg-edit-text { font-size: 16px; }
}

/* ======================================================================
   Header (2026-10-15): brand on the left, Inbox | Performance in the
   true center, and everything else behind one settings gear on the right.
   ====================================================================== */
.topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; }
.topbar-start { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand { min-width: 0; }
.brand-text { min-width: 0; }
.brand-text .brand-name, .brand-text .brand-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-end { position: relative; justify-self: end; display: flex; align-items: center; }

.view-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--border); }
.view-tab { background: none; border: none; color: var(--text-muted); font: inherit; font-size: 13px; padding: 5px 14px; border-radius: 7px; cursor: pointer; }
.view-tab:hover { color: var(--text); }
.view-tab.active { background: var(--accent-soft); color: var(--text); }

.settings-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text-muted); }
.settings-btn:hover, .settings-btn[aria-expanded="true"] { color: var(--text); border-color: rgba(255,255,255,0.18); }

.settings-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  display: none; flex-direction: column; min-width: 240px; padding: 6px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 14px 34px rgba(0,0,0,.55);
}
.settings-menu.open { display: flex; }
.settings-menu .hidden { display: none !important; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; min-width: 0; }
.menu-email { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; background: none; border: none; color: var(--text); font: inherit; font-size: 13.5px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible, .menu-item[aria-expanded="true"] { background: var(--panel-2); outline: none; }
.menu-chevron { color: var(--text-muted); font-size: 16px; line-height: 1; transition: transform .15s; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 2px; }
.view-tab:focus-visible, .settings-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* "Remove a LinkedIn account": a second menu that opens beside the first. */
.submenu {
  position: absolute; right: calc(100% + 8px); top: 0; width: 280px; max-height: 360px; overflow-y: auto;
  padding: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 14px 34px rgba(0,0,0,.55);
}
.submenu-title { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); padding: 6px 8px 6px; }
.submenu-list { list-style: none; margin: 0; padding: 0; }
.submenu-list li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; min-width: 0; }
.submenu-list li:hover { background: var(--panel-2); }
.submenu-list .acc-name { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.submenu-list .acc-client { display: block; font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.submenu-list .acc-remove { background: none; border: 1px solid rgba(224,101,79,0.35); color: var(--danger); font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 6px; cursor: pointer; flex-shrink: 0; }
.submenu-list .acc-remove:hover, .submenu-list .acc-remove:focus-visible { background: var(--danger-soft); outline: none; }
.submenu-list .acc-wait { white-space: normal; }
.submenu-list .acc-resync { background: none; border: 1px solid var(--border); color: var(--accent); font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 6px; cursor: pointer; flex-shrink: 0; }
.submenu-list .acc-resync:hover:not(:disabled), .submenu-list .acc-resync:focus-visible { background: var(--panel-2); outline: none; }
.submenu-list .acc-resync:disabled { color: var(--text-muted); cursor: not-allowed; opacity: .6; }
.confirm-note { margin: 12px 0 0; padding: 10px 12px; font-size: 12.5px; line-height: 1.5; color: var(--text); background: var(--panel-2); border-left: 3px solid var(--accent); border-radius: 6px; }
.confirm-note strong { font-weight: 600; }
.submenu-empty { font-size: 12.5px; color: var(--text-muted); padding: 6px 8px 8px; }

.btn-danger { background: var(--danger); color: #fff; }
.confirm-text { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text); }
.confirm-text strong { font-weight: 600; }
#removeAccountModal .modal-card { width: 440px; }

/* ======================================================================
   Performance page
   Colors checked with the palette validator against both dark surfaces:
   reply rate blue and acceptance amber are told apart by every kind of
   color vision (and always carry a label too); industries with too few
   leads to judge are the de-emphasis gray. Values and labels use the text
   colors, never a chart color.
   ====================================================================== */
:root {
  --reply: #3c96c5;
  --accept: #b48b2b;
  --bar: var(--reply);
  --bar-muted: #5f5f70;
  --grid: rgba(255,255,255,0.07);
  /* Compare industries: three hues that stay apart for every kind of
     color vision even where lines cross (validated all-pairs on --panel). */
  --cmp-1: #3987e5;
  --cmp-2: #d95926;
  --cmp-3: #199e70;
  --cmp-4: #c98500;
  --cmp-5: #d55181;
  --up: #4ade80;
  --down: #e0654f;
  /* Reply-rate tiers (status colors: red, orange, yellow, green). Checked
     with the palette validator on --panel: neighbours stay apart for normal
     and color-blind vision. Every tier is also named in words on screen. */
  --tier-low: #d42f4f;
  --tier-fair: #ef7d3a;
  --tier-good: #f2cd2e;
  --tier-strong: #0ca30c;
  /* Leads by Status colors live in app.js (STATUS_DEFS), matching the
     status colors in the leads tables. */
}

.perf { flex: 1; min-height: 0; overflow-y: auto; background: var(--bg); }
.perf-inner { max-width: 1120px; margin: 0 auto; padding: 28px 28px 56px; transition: opacity .15s; }
.perf-inner.loading { opacity: .55; }
.perf-head h1 { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.perf-sub { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; max-width: 70ch; }

.perf-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 20px 0 18px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--panel); border: 1px solid var(--border); }
.seg button { background: none; border: none; color: var(--text-muted); font: inherit; font-size: 12.5px; padding: 6px 11px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.seg button:focus-visible, .perf-select:focus-visible, .ind-row:focus-visible, .report-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.perf-select { font: inherit; font-size: 12.5px; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 7px 28px 7px 10px; max-width: 240px; }

.report-wrap { position: relative; margin-left: auto; }
.report-btn { font-size: 13px; padding: 8px 16px; }
.report-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 250px; padding: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 14px 34px rgba(0,0,0,.55); }
.report-menu .menu-item { flex-direction: column; align-items: flex-start; gap: 1px; }
.report-kind { font-size: 13.5px; }
.report-desc { font-size: 12px; color: var(--text-muted); }
.report-note { font-size: 11.5px; color: var(--text-muted); margin: 4px 10px 4px; }

.perf-notice { margin: 0 0 16px; padding: 12px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border); color: var(--text-muted); font-size: 13px; }

/* Summary: the two rates lead, then the three counts. */
.perf-kpis { display: grid; grid-template-columns: 1.3fr 1.3fr 1fr 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; min-width: 0; }
.kpi-label { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 7px; }
.key-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.key-dot.reply { background: var(--reply); }
.key-dot.accept { background: var(--accept); }
.kpi-value { font-size: 28px; font-weight: 600; line-height: 1.15; margin-top: 6px; letter-spacing: -0.01em; }
.kpi-hero .kpi-value { font-size: 44px; line-height: 1.05; }
.kpi-foot { font-size: 12px; color: var(--text-muted); margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-delta { font-size: 12px; color: var(--text-muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.delta-up, .delta-down, .delta-flat { font-weight: 600; }
.delta-up { color: var(--up); }
.delta-down { color: var(--down); }
.delta-flat { color: var(--text-muted); }

/* Industry ranking */
.perf-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px 18px 8px; min-width: 0; }
.perf-card-head h2 { font-size: 15px; font-weight: 600; margin: 0; }
.perf-card-sub { font-size: 12.5px; color: var(--text-muted); margin: 4px 0 0; }

.ind-cols, .ind-main, .ind-senders li { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(0, 2.6fr) 84px 118px; gap: 16px; align-items: center; }
.with-change .ind-cols, .with-change .ind-main, .with-change .ind-senders li { grid-template-columns: minmax(0, 2fr) minmax(0, 2.2fr) 84px 84px 118px; }
.col-change { display: none; }
.with-change .col-change { display: block; }
.ind-cols { margin-top: 16px; padding: 0 8px 8px; border-bottom: 1px solid var(--grid); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.ind-list { list-style: none; margin: 0; padding: 0; }
.ind-row { border-bottom: 1px solid var(--grid); border-radius: 8px; cursor: pointer; outline: none; }
.ind-row:last-child { border-bottom: none; }
.ind-main { padding: 11px 8px; border-radius: 8px; }
.ind-row:hover .ind-main, .ind-row:focus-visible .ind-main { background: var(--panel-2); }
.ind-name { font-size: 13.5px; line-height: 1.3; overflow-wrap: anywhere; display: flex; align-items: flex-start; gap: 6px; }
.ind-name::before { content: '›'; color: var(--text-muted); transition: transform .15s; display: inline-block; width: 8px; flex-shrink: 0; }
.ind-row[aria-expanded="true"] .ind-name::before { transform: rotate(90deg); }
.ind-row.no-senders { cursor: default; }
.ind-row.no-senders .ind-name::before { visibility: hidden; }
.ind-count { font-size: 12.5px; color: var(--text-muted); }
.ind-accept { font-size: 12.5px; color: var(--text); white-space: nowrap; }
.ind-accept b { font-weight: 600; }
.ind-accept small { font-size: 11.5px; color: var(--text-muted); margin-left: 6px; }
.m-label { display: none; }
.ind-change { font-size: 12.5px; }

.ind-bar-cell { display: block; position: relative; height: 22px; padding-right: 48px; }
.ind-track { display: block; position: relative; width: 100%; height: 100%; }
.ind-bar, .ind-avg, .ind-rate { display: block; }
.ind-bar { position: absolute; left: 0; top: 50%; transform: translateY(-50%); height: 10px; min-width: 2px; background: var(--bar); border-radius: 0 4px 4px 0; transition: width .25s ease; }
.ind-row:hover .ind-bar, .ind-row:focus-visible .ind-bar { filter: brightness(1.15); }
.ind-rate { position: absolute; top: 50%; transform: translateY(-50%); font-size: 12.5px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 8px; }
.ind-avg { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--highlight); opacity: .55; pointer-events: none; }
.ind-list.thin .ind-bar { background: var(--bar-muted); }
.ind-list.thin .ind-name, .ind-list.thin .ind-rate { color: var(--text-muted); }
.ind-sub { font-size: 12px; font-weight: 500; color: var(--text-muted); margin: 18px 8px 4px; }

.ind-senders { list-style: none; margin: 0 0 8px; padding: 2px 0 6px; }
.ind-senders li { padding: 6px 8px; }
.ind-senders .s-name { font-size: 12.5px; color: var(--text-muted); padding-left: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ind-senders .ind-bar-cell { height: 18px; }
.ind-senders .ind-bar { height: 6px; opacity: .8; }
.ind-senders .ind-rate { font-weight: 500; font-size: 12px; color: var(--text-muted); }

.perf-empty { color: var(--text-muted); font-size: 13px; padding: 16px 8px; margin: 0; }
.perf-foot { color: var(--text-muted); font-size: 12px; margin: 10px 8px 8px; padding-top: 10px; border-top: 1px solid var(--grid); }

/* Trends */
.perf-trends { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 16px; }
.chart-card { padding-bottom: 14px; }
/* Charts stay inside their own card, whatever the data says. */
#rateChart, #compareChart, #statusPie { overflow: hidden; }
svg.line-chart { overflow: hidden; display: block; max-width: 100%; }
.tip-note { margin-top: 6px; max-width: 260px; font-size: 11.5px; line-height: 1.4; color: var(--text-muted); white-space: normal; }
.chart-wide { grid-column: 1 / -1; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12px; color: var(--text-muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.line-key { display: inline-block; width: 16px; height: 2px; border-radius: 1px; }
.line-key.reply { background: var(--reply); }
.line-key.accept { background: var(--accept); }
.line-key.bench { height: 0; background: none; border-top: 2px dashed var(--text-muted); }
.chart-note { font-size: 12px; color: var(--text-muted); margin: 8px 0 0; }
.chart-box .bench-line { stroke: var(--text-muted); stroke-width: 1.25; stroke-dasharray: 5 4; }
.chart-box .bench-label { fill: var(--text-muted); font-size: 11px; }
#senderCard { margin-top: 16px; }
.chart-box { position: relative; margin-top: 10px; }
.chart-box svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-box .tick { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-box .gridline { stroke: var(--grid); stroke-width: 1; }
.chart-box .crosshair { stroke: var(--highlight); stroke-opacity: .45; stroke-width: 1; }
.chart-box .end-label { fill: var(--text); font-size: 12px; font-weight: 600; }
.chart-box .col-label { fill: var(--text); font-size: 11.5px; font-weight: 600; }
.chart-box .col { fill: var(--bar); }
.chart-box .col.partial { fill-opacity: .55; }
.chart-box .col:hover, .chart-box .col.hover { filter: brightness(1.18); }
.chart-empty { color: var(--text-muted); font-size: 13px; padding: 30px 0; min-height: 160px; margin: 0; }
.sender-list { margin-top: 0; }
.sender-list .ind-main { grid-template-columns: minmax(0, 2.1fr) minmax(0, 2.6fr) 84px 118px; }

.perf-tip { position: fixed; z-index: 70; pointer-events: none; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px; color: var(--text-muted); box-shadow: 0 10px 24px rgba(0,0,0,.45); max-width: 290px; }
.perf-tip strong { display: block; color: var(--text); font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.perf-tip .tip-name { color: var(--text); margin-bottom: 4px; }
.perf-tip .tip-row { display: flex; align-items: center; gap: 8px; color: var(--text); }
.perf-tip .tip-row b { font-weight: 600; min-width: 36px; }
.perf-tip .tip-bench { color: var(--text-muted); }

@media (max-width: 820px) {
  /* Brand and gear on the first row, the switch across the second. */
  .topbar { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "start end" "tabs tabs"; row-gap: 8px; }
  .topbar-start { grid-area: start; }
  .topbar-end { grid-area: end; }
  .view-tabs { grid-area: tabs; width: 100%; }
  .view-tab { flex: 1; padding: 7px 10px; font-size: 14px; }
  .settings-btn { width: 40px; height: 40px; }
  .settings-menu { position: fixed; top: auto; left: 10px; right: 10px; bottom: auto; min-width: 0; margin-top: 8px; }
  .settings-menu.open { top: calc(env(safe-area-inset-top, 0px) + 58px); }
  .menu-item { padding: 12px 10px; font-size: 15px; }
  /* On a phone the second menu opens in place, under its button. */
  .submenu { position: static; width: auto; max-height: none; box-shadow: none; border: none; background: var(--panel-2); margin: 2px 0 4px; }
  .menu-item.has-sub[aria-expanded="true"] .menu-chevron { transform: rotate(90deg); }

  .perf-inner { padding: 16px 14px 40px; }
  .perf-head h1 { font-size: 18px; }
  .perf-filters { gap: 8px; margin: 14px 0 14px; }
  .seg { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .seg button { padding: 8px 6px; font-size: 13px; }
  .perf-select { flex: 1; min-width: 0; max-width: none; font-size: 16px; }
  .report-wrap { width: 100%; margin-left: 0; }
  .report-btn { width: 100%; padding: 10px 16px; font-size: 14px; }
  .report-menu { left: 0; right: 0; width: auto; }

  .perf-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 12px; grid-column: span 2; }
  .kpi-hero { grid-column: span 3; padding: 14px; }
  .kpi-hero .kpi-value { font-size: 34px; }
  .kpi-value { font-size: 22px; }
  .kpi-foot { white-space: normal; font-size: 11.5px; line-height: 1.3; }

  .perf-card { padding: 14px 10px 6px; }
  .ind-cols { display: none; }
  .ind-main, .with-change .ind-main, .sender-list .ind-main { grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px 12px; padding: 12px 6px; }
  .ind-name { grid-column: 1 / -1; font-size: 14px; }
  .ind-main .ind-bar-cell { grid-column: 1 / -1; }
  /* No column headings on a phone, so the numbers say what they are,
     on one line under the bar: "19 of 64 replied · 70% accepted 70 of 100". */
  .m-label { display: inline; color: var(--text-muted); }
  .ind-main .num, .ind-senders .num { text-align: left; }
  .ind-main, .with-change .ind-main, .sender-list .ind-main { grid-template-columns: auto auto minmax(0, 1fr); }
  .ind-senders li, .with-change .ind-senders li { grid-template-columns: auto auto minmax(0, 1fr); }
  .ind-accept small { margin-left: 4px; }
  .ind-senders li, .with-change .ind-senders li { grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 12px; padding: 6px 6px; }
  .ind-senders .s-name, .ind-senders .ind-bar-cell { grid-column: 1 / -1; }

  .perf-trends { grid-template-columns: 1fr; }
}
.client-company { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; font-size: 12.5px; color: var(--text-muted); }
.client-company strong { color: var(--text); font-weight: 600; }
.client-company .link-btn { margin-left: 4px; }

/* Clickable tiles: Replies and Marked as Positive open their leads. */
.kpi-link { position: relative; display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; text-align: left; font: inherit; color: inherit; cursor: pointer; width: 100%; transition: border-color .15s, background .15s; }
.kpi-link > span { display: block; }
.kpi-link .kpi-label { display: flex; }
/* Sits in the corner, so it never pushes the label onto two lines. */
.kpi-open { position: absolute; top: 15px; right: 16px; font-size: 11.5px; color: var(--accent); opacity: 0; transition: opacity .15s; }
.perf-tip.wide { max-width: 360px; }
.kpi-link:hover:not(:disabled), .kpi-link:focus-visible { border-color: rgba(112,157,184,0.55); background: var(--panel-2); outline: none; }
.kpi-link:hover:not(:disabled) .kpi-open, .kpi-link:focus-visible .kpi-open { opacity: 1; }
.kpi-link:disabled { cursor: default; }
#perfRankNote.hidden { display: none; }

/* Compare industries */
.compare-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.compare-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.seg-small button { font-size: 12px; padding: 5px 10px; }
.compare-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; min-height: 30px; }
.compare-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 4px 4px 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--panel-2); font-size: 12.5px; }
.compare-chip .chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.compare-chip .line-key { flex-shrink: 0; width: 14px; height: 3px; }
.chip-remove { background: none; border: none; color: var(--text-muted); font-size: 15px; line-height: 1; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; flex-shrink: 0; }
.chip-remove:hover, .chip-remove:focus-visible { background: var(--panel); color: var(--text); outline: none; }
#compareAdd:disabled { opacity: .55; }

/* The leads behind a tile */
.leads-card { width: 640px; }
.leads-search { width: 100%; font: inherit; font-size: 13px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); color: var(--text); }
.leads-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.lead-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; text-align: left; background: none; border: none; border-radius: 8px; padding: 10px; color: var(--text); font: inherit; cursor: pointer; }
.lead-row:hover:not(:disabled), .lead-row:focus-visible { background: var(--panel-2); outline: none; }
.lead-row:disabled { cursor: default; }
.lead-who { display: flex; flex-direction: column; min-width: 0; }
.lead-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-company, .lead-meta { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-side { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.lead-open { color: var(--accent); }
.leads-empty { color: var(--text-muted); font-size: 13px; padding: 16px 4px; }

@media (max-width: 820px) {
  /* Touch screens can't hover, so the link shows at the foot of the tile. */
  .kpi-open { opacity: 1; position: static; margin-top: auto; padding-top: 8px; }
  .compare-controls { width: 100%; }
  .compare-controls .seg { width: 100%; }
  .compare-controls .perf-select { width: 100%; flex: 1 1 100%; }
  .lead-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 12px 8px; }
  .lead-meta { grid-column: 1 / -1; grid-row: 2; }
  .leads-card { width: 100%; }
}

/* ======================================================================
   Reply-rate tiers, the "where you stand" scale, row actions
   ====================================================================== */
.tier-low { --tier: var(--tier-low); }
.tier-fair { --tier: var(--tier-fair); }
.tier-good { --tier: var(--tier-good); }
.tier-strong { --tier: var(--tier-strong); }

/* Bars take their tier's color; thin industries keep it, faded. */
.ind-bar[class*="tier-"] { background: var(--tier); }
.ind-list.thin .ind-bar[class*="tier-"] { background: repeating-linear-gradient(135deg, var(--tier) 0 3px, color-mix(in srgb, var(--tier) 25%, transparent) 3px 6px); opacity: .65; }
.ind-senders .ind-bar[class*="tier-"] { opacity: .75; }
/* The LinkedIn-average marker on every bar. */
.ind-avg { width: 0; background: none; border-left: 1.5px dashed var(--text); opacity: .55; }
.ind-bar { transition: width .45s cubic-bezier(.2,.7,.2,1); }
@media (prefers-reduced-motion: reduce) { .ind-bar { transition: none; } }

/* Column heading key for the marker. */
.col-key { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; text-transform: none; letter-spacing: 0; color: var(--text-muted); }
.col-key i { display: inline-block; height: 11px; border-left: 1.5px dashed var(--text); opacity: .6; }

/* A small named tier: dot + word. */
.tier-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 500; color: var(--text); background: color-mix(in srgb, var(--tier) 16%, transparent); border: 1px solid color-mix(in srgb, var(--tier) 38%, transparent); white-space: nowrap; }
.tier-chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--tier); flex-shrink: 0; }
.kpi-hero .kpi-label .tier-chip { margin-left: auto; }

/* Where you stand: the LinkedIn average and this view on one tiered scale. */
.perf-standing { display: block; margin-bottom: 12px; padding: 14px 20px; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--border); border-radius: 14px; }
.st-bench { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; min-width: 0; }
.st-bench .bm-label { font-size: 13px; color: var(--text-muted); line-height: 1.35; }
.st-bench .bm-value { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.st-bench .bm-compare { margin: 0 0 0 auto; font-size: 13px; color: var(--text-muted); }
.st-bench .bm-compare b { color: var(--text); font-weight: 600; }

/* Row details: senders plus quick actions, for industries and senders. */
.ind-detail { padding: 2px 8px 12px 22px; }
.ind-detail .ind-senders { margin: 0 0 6px; padding-top: 0; }
.ind-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ind-action { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12.5px; color: var(--text); background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 11px; cursor: pointer; transition: border-color .15s, background .15s; }
.ind-action:hover, .ind-action:focus-visible { border-color: rgba(112,157,184,0.55); background: var(--panel); outline: none; }
.ind-action svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--text-muted); }
.ind-action:disabled { opacity: .5; cursor: default; }
.ind-row[aria-expanded="true"] { background: rgba(255,255,255,0.015); }
.ind-row[aria-expanded="true"] .ind-main { background: var(--panel-2); }

/* A card the page just jumped to glows briefly. */
.perf-card.flash { animation: perf-flash 1.1s ease-out; }
@keyframes perf-flash { 0% { box-shadow: 0 0 0 2px rgba(112,157,184,0.65); } 100% { box-shadow: 0 0 0 2px rgba(112,157,184,0); } }
@media (prefers-reduced-motion: reduce) { .perf-card.flash { animation: none; } }

/* Cards: a touch more depth. */
.perf-card, .kpi { box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 8px 24px rgba(0,0,0,0.18); }
.perf-card-head h2 { letter-spacing: -0.005em; }

/* On a desktop the filters stay in reach while scrolling. */
@media (min-width: 821px) {
  .perf-filters { position: sticky; top: 0; z-index: 20; margin: 12px -28px 14px; padding: 10px 28px; background: var(--bg); border-bottom: 1px solid transparent; transition: border-color .15s; }
  /* Jumping to a card leaves room for the pinned filter bar. */
  .perf-card { scroll-margin-top: 76px; }
  .perf-filters.stuck { border-bottom-color: var(--border); }
}

@media (max-width: 820px) {
  .perf-standing { padding: 14px; }
  .st-bench { flex-direction: column; align-items: flex-start; gap: 2px; }
  .st-bench .bm-compare { margin: 4px 0 0; }
  .ind-detail { padding: 2px 6px 12px 6px; }
  .ind-action { padding: 9px 12px; font-size: 13px; }
}

/* Requests Sent, tucked under Leads Contacted. */

/* Connection Requests Sent above Leads Contacted, in one tile. */
.kpi-pair { display: flex; flex-direction: column; gap: 10px; }
.kpi-pair .kpi-stat + .kpi-stat { padding-top: 10px; border-top: 1px solid var(--grid); }
.kpi-pair .kpi-value { font-size: 22px; margin-top: 3px; }
@media (max-width: 820px) {
  .kpi-pair { gap: 8px; }
  .kpi-pair .kpi-stat + .kpi-stat { padding-top: 8px; }
  .kpi-pair .kpi-value { font-size: 20px; }
}

/* Leads by Status */
.expand-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); }
.expand-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.expand-btn:hover, .expand-btn:focus-visible { color: var(--text); border-color: rgba(112,157,184,0.55); outline: none; }
.expand-btn:disabled { opacity: .4; cursor: default; }
.status-wrap { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px 40px; align-items: center; margin-top: 16px; }
.status-wrap.compact { grid-template-columns: 180px minmax(0, 1fr); margin-top: 0; }
.status-pie { width: 100%; display: flex; justify-content: center; }
.status-pie svg.pie { display: block; overflow: visible; }
/* A hairline of the card color between slices keeps them crisp and apart. */
.pie-slice { stroke: var(--panel); stroke-width: 1.5; stroke-linejoin: round; cursor: pointer; transition: opacity .15s ease; }
.pie.hovering .pie-slice:not(.active) { opacity: .55; }
.pie-label { font-size: 13.5px; font-weight: 700; letter-spacing: -0.01em; pointer-events: none; font-variant-numeric: tabular-nums; }
.status-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(var(--legend-rows, 5), auto); grid-auto-flow: column; gap: 2px 24px; max-width: 620px; }
.legend-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 52px; align-items: center; gap: 9px; width: 100%; background: none; border: none; border-radius: 7px; padding: 6px 8px; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.legend-row:hover:not(:disabled), .legend-row:focus-visible { background: var(--panel-2); outline: none; }
.legend-row:disabled { cursor: default; }
.legend-row.empty .legend-name, .legend-row.empty .legend-count { color: var(--text-muted); }
.legend-row.empty .legend-dot { opacity: .45; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }
.legend-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-count { color: var(--text); font-variant-numeric: tabular-nums; text-align: right; }
.legend-pct { color: var(--text-muted); font-variant-numeric: tabular-nums; text-align: right; font-size: 12px; }
.tip-hint { color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }
.lead-status { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel-2); font-size: 11.5px; color: var(--text); white-space: nowrap; }
.lead-status i { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

.status-modal-card { width: 760px; max-height: 90vh; }
.leads-view { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.status-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding-top: 4px; border-top: 1px solid var(--grid); }
.status-tools .leads-search { flex: 1 1 200px; width: auto; }
.status-filter { position: relative; }
.status-filter-btn { font: inherit; font-size: 12.5px; color: var(--text); background: var(--panel-2); border: 1px solid var(--accent); border-radius: 8px; padding: 7px 12px; cursor: pointer; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.status-filter-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.status-filter-menu { position: absolute; left: 0; top: calc(100% + 6px); z-index: 5; width: 270px; padding: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 14px 34px rgba(0,0,0,.55); display: flex; flex-direction: column; gap: 6px; }
.status-filter-menu input[type="search"] { font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel-2); color: var(--text); }
.status-filter-options { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; }
.filter-option { display: flex !important; flex-direction: row !important; align-items: center; gap: 9px !important; padding: 6px 6px; border-radius: 7px; cursor: pointer; font-weight: 400 !important; }
.filter-option:hover { background: var(--panel-2); }
.filter-option input { accent-color: var(--accent); padding: 0 !important; }
.filter-option .legend-count { margin-left: auto; color: var(--text-muted); font-size: 12px; }
.status-filter-foot { display: flex; justify-content: flex-end; border-top: 1px solid var(--grid); padding-top: 6px; }
.status-count { margin: 0; font-size: 12px; color: var(--text-muted); }
.status-more { align-self: center; }

.lead-detail { display: flex; flex-direction: column; gap: 12px; }
.detail-back { align-self: flex-start; }
.detail-name { font-size: 18px; margin: 0; }
.detail-list { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px 16px; margin: 0; font-size: 13.5px; }
.detail-list dt { color: var(--text-muted); }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; }
.detail-actions a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.detail-note { margin: 0; font-size: 12.5px; color: var(--text-muted); }

@media (max-width: 820px) {
  .status-wrap, .status-wrap.compact { grid-template-columns: 1fr; justify-items: center; }
  .status-pie { width: 220px; }
  .status-legend { width: 100%; grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; }
  .status-tools .perf-select { flex: 1 1 100%; }
  .status-filter, .status-filter-btn { width: 100%; max-width: none; }
  .status-filter-menu { width: 100%; }
  .detail-list { grid-template-columns: 1fr; gap: 2px; }
  .detail-list dd { margin-bottom: 8px; }
}

/* ======================================================================
   Performance page colors: the Morris Strategies light scheme
   Only the Performance page, its pop-ups and (while it shows) the top bar
   take these colors; the inbox, logo and fonts stay as they are. Matched to the onboarding
   page: light gray page, white cards and fields, navy (#121D36) text and
   solid buttons, tertiary blue (#709DB8) as the thin accent.
   ====================================================================== */
.pie-ring { fill: none; stroke: var(--border); stroke-width: 1; }

#performanceView, #statusModal, #leadsModal {
  color-scheme: light;
  --navy: #121d36;
  --bg: #f3f5f8;
  --panel: #ffffff;
  --panel-2: #f3f5f8;
  --border: #d8e0e7;
  --field-border: #c6cfd7;
  --text: #121d36;
  --text-muted: #5b6571;
  --accent: #709db8;
  --accent-ink: #33627f;
  --accent-soft: rgba(112,157,184,0.16);
  --highlight: #d6e0e8;
  --highlight-soft: rgba(214,224,232,0.55);
  --grid: rgba(18,29,54,0.08);
  --reply: #006c99;
  --accept: #aa7e00;
  --bar: var(--reply);
  --bar-muted: #a9b4bc;
  --cmp-1: #2a78d6;
  --cmp-2: #eb6834;
  --cmp-3: #1baf7a;
  --cmp-4: #eda100;
  --cmp-5: #e87ba4;
  --up: #15803d;
  --down: #b42318;
  --tier-low: #c2264f;
  --tier-fair: #e06a22;
  --tier-good: #cfae00;
  --tier-strong: #0a8f0a;
  --positive: #15803d;
  --positive-soft: rgba(21,128,61,0.1);
  --longfu: #c2410c;
  --longfu-soft: rgba(194,65,12,0.09);
  --results: #4b5563;
  --results-soft: rgba(75,85,99,0.1);
  --negative: #b42318;
  --negative-soft: rgba(180,35,24,0.09);
  --unread: #33627f;
  --unread-soft: rgba(112,157,184,0.18);
  --checkresults: #1d6fa5;
  --checkresults-soft: rgba(29,111,165,0.1);
  --respond: #a16207;
  --respond-soft: rgba(161,98,7,0.1);
  --danger: #b42318;
  --shadow: 0 1px 2px rgba(18,29,54,0.05), 0 6px 18px rgba(18,29,54,0.06);
  --shadow-pop: 0 14px 34px rgba(18,29,54,0.16);
  color: var(--text);
}
#performanceView { background: var(--bg); }
#statusModal, #leadsModal { background: rgba(18,29,54,0.32); }
#performanceView .perf-card, #performanceView .kpi { box-shadow: var(--shadow); }
#performanceView .ind-row[aria-expanded="true"] { background: var(--bg); }
#performanceView .report-menu, #statusModal .status-filter-menu, #performanceView .perf-tip { box-shadow: var(--shadow-pop); }
#performanceView .perf-tip strong, #performanceView .perf-tip .tip-row { color: var(--text); }
/* Fields: white with a soft gray-blue edge. */
#performanceView .perf-select, #statusModal input, #statusModal select, #leadsModal input { background: var(--panel); border-color: var(--field-border); color: var(--text); }
#performanceView .seg { background: var(--highlight-soft); }
#performanceView .seg button.active { background: var(--panel); box-shadow: 0 1px 2px rgba(18,29,54,0.08), inset 0 0 0 1px var(--border); }
/* Solid buttons in navy. */
#performanceView .btn-primary, #performanceView .report-btn, #statusModal .btn-primary, #leadsModal .btn-primary { background: var(--navy); color: #fff; }
/* Accent text one step deeper so it reads on white. */
#performanceView .link-btn, #statusModal .link-btn, #leadsModal .link-btn,
#performanceView .kpi-open, #statusModal .lead-open, #leadsModal .lead-open { color: var(--accent-ink); }
#performanceView .kpi-link:hover:not(:disabled), #performanceView .kpi-link:focus-visible { border-color: var(--accent); background: var(--panel); }
/* The LinkedIn average: a navy band with an accent edge, like the
   onboarding page's callout. */
#performanceView .perf-standing { background: var(--navy); border-color: var(--navy); }
#performanceView .perf-standing .bm-label, #performanceView .perf-standing .bm-compare { color: #c9d4de; }
#performanceView .perf-standing .bm-value, #performanceView .perf-standing .bm-compare b { color: #fff; }
#performanceView .perf-filters { background: var(--bg); }
#statusModal .modal-card, #leadsModal .modal-card { background: var(--panel); border-color: var(--border); }

/* The top bar keeps the inbox's dark colors on both pages. */

/* The dissolve between Inbox and Performance. */
::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: 480ms;
  animation-timing-function: cubic-bezier(.4, 0, .2, 1);
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
