/* Trafficholic Social multi-account console */

.th-social-console-inner {
  max-width: 1120px;
}

.th-social-console-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.is-on { color: #3f7a0c; }
.is-off { color: #8a1f1f; }

.th-pill {
  display: inline-block;
  min-width: 1.4em;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: #ff4d6d;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.5;
}

.th-tag {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  border-radius: 6px;
  background: #fff4d6;
  color: #7a5a00;
  font-size: 0.72rem;
  font-weight: 600;
}

.th-tag--sent { background: #e7f5c8; color: #355208; }
.th-tag--skipped { background: #eef0f3; color: #4b5260; }
.th-tag--error { background: #fff1f1; color: #8a1f1f; }

.th-btn-sm {
  padding: 0.4rem 0.8rem !important;
  font-size: 0.82rem !important;
  min-height: 0 !important;
  width: auto !important;
}

/* Hub cards */
.th-social-account-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.th-social-account-card {
  border: 1px solid var(--th-line, #e7ebdf);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}

.th-social-account-card__main {
  display: flex;
  gap: 0.9rem;
  padding: 1rem 1.1rem;
  color: inherit;
  text-decoration: none;
}

.th-social-account-card__main img,
.th-social-account-card__fallback {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.th-social-account-card__fallback {
  display: grid;
  place-items: center;
  background: #eef8d4;
  color: #3f5a0c;
  font-weight: 700;
}

.th-social-account-card h2 {
  margin: 0 0 0.2rem;
  font-size: 1.15rem;
}

.th-social-account-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  padding: 0.65rem 1.1rem 0.9rem;
  border-top: 1px solid var(--th-line, #e7ebdf);
  background: #fbfcf8;
  font-size: 0.9rem;
}

.th-social-account-card__actions a {
  color: #3f5a0c;
  font-weight: 600;
  text-decoration: none;
}

.th-social-account-card__actions a.is-danger {
  color: #8a1f1f;
  margin-left: auto;
}

/* Hub platform switcher */
.th-hub-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin: 0 0 0.65rem;
}

.th-hub-head__titles h1 {
  margin: 0.2rem 0 0;
  font-size: 1.45rem;
}

.th-platform-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-left: auto;
}

.th-platform-switch__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--th-line, #e7ebdf);
  background: #fff;
  color: #3a4236;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 650;
}

.th-platform-switch__btn em {
  font-style: normal;
  font-size: 0.65rem;
  color: #8a9380;
  font-weight: 600;
}

.th-platform-switch__btn.is-active {
  background: #151a14;
  border-color: #151a14;
  color: #e7f5c8;
}

.th-platform-switch__btn.is-active em {
  color: #9fd428;
}

.th-platform-switch__short {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  border-radius: 6px;
  background: #f2f7e6;
  font-size: 0.68rem;
  font-weight: 800;
}

.th-platform-switch__btn.is-active .th-platform-switch__short {
  background: #2a3326;
  color: #9fd428;
}

.th-platform-soon__badge {
  display: inline-block;
  margin: 0 0 0.5rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 0.72rem;
  font-weight: 700;
}

.th-platform-soon__list {
  margin: 0.75rem 0 1rem;
  padding-left: 1.1rem;
}

.th-platform-soon .th-social-btn {
  margin-right: 0.4rem;
  margin-top: 0.35rem;
}

.th-social-meta--quiet {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  color: #8a9380;
}

/* Workspace account strip (tabs live in site header) */
.th-ws-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  margin: 0 0 0.55rem;
}

.th-ws-topbar--account {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--th-line, #e7ebdf);
  margin-bottom: 0.75rem;
}

.th-social-back {
  margin: 0;
  font-size: 0.8rem;
  color: var(--th-muted, #6b7564);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.th-ws-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.th-ws-head img,
.th-avatar--sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px #9fd428;
}

.th-ws-head h1 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.2;
}

.th-ws-head__meta {
  margin: 0.1rem 0 0;
  color: var(--th-muted, #6b7564);
  font-size: 0.75rem;
}

.th-social-nav {
  position: relative;
  margin-left: auto;
}

.th-social-nav__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--th-line, #e7ebdf);
  background: #151a14;
  color: #e7f5c8;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.th-social-nav__caret { opacity: 0.8; font-size: 0.75rem; }

.th-social-nav__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 11rem;
  padding: 0.35rem;
  border: 1px solid var(--th-line, #e7ebdf);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(17, 20, 17, 0.12);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.th-social-nav__menu[hidden] { display: none; }

.th-social-nav__menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.th-social-nav__menu a:hover,
.th-social-nav__menu a.is-active {
  background: #f2f7e6;
}

.th-queue-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0 0 1rem;
}

@media (max-width: 1100px) {
  .th-queue-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .th-queue-grid { grid-template-columns: 1fr; }
  .th-ws-topbar { align-items: stretch; }
  .th-social-nav { margin-left: 0; width: 100%; }
  .th-social-nav__toggle { width: 100%; justify-content: space-between; }
  .th-social-nav__menu { left: 0; right: 0; }
}

.th-queue-card {
  border: 1px solid var(--th-line, #e7ebdf);
  border-radius: 14px;
  background: #fff;
  padding: 0.85rem 0.95rem;
  border-top: 3px solid #9fd428;
}

.th-queue-card--follow { border-top-color: #e11d48; }
.th-queue-card--booking { border-top-color: #f59e0b; }
.th-queue-card--silent { border-top-color: #64748b; }
.th-queue-card--booked { border-top-color: #16a34a; }

.th-queue-card header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.th-queue-card h3 {
  margin: 0;
  font-size: 0.95rem;
}

.th-queue-card__n {
  font-size: 1.55rem;
  line-height: 1;
  font-weight: 800;
}

.th-queue-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  max-height: 220px;
  overflow: auto;
}

.th-queue-list a {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  padding: 0.4rem 0.15rem;
  border-bottom: 1px solid #f0f2ea;
  color: inherit;
  text-decoration: none;
  font-size: 0.82rem;
}

.th-queue-list a:hover { background: #fbfcf8; }
.th-queue-list em { color: var(--th-muted, #6b7564); font-style: normal; font-size: 0.75rem; }

.th-avatar {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #f9d65c, #ff6f91 60%, #8e5cff);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}

.th-avatar--lg {
  width: 52px;
  height: 52px;
}

.th-social-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
}

.th-social-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--th-line, #e7ebdf);
  background: #fff;
  color: var(--th-ink, #111);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.th-social-tabs a.is-active {
  background: #151a14;
  border-color: #151a14;
  color: #e7f5c8;
}

/* Inbox */
.th-inbox {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 560px;
  border: 1px solid var(--th-line, #e7ebdf);
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
}

.th-inbox__list {
  border-right: 1px solid var(--th-line, #e7ebdf);
  background: #fbfcf8;
  display: flex;
  flex-direction: column;
  max-height: 720px;
}

.th-inbox__search {
  margin: 0.75rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid #d5dcc8;
  border-radius: 10px;
  font: inherit;
  background: #fff;
}

.th-inbox__list ul {
  list-style: none;
  margin: 0;
  padding: 0 0.4rem 0.6rem;
  overflow-y: auto;
}

.th-inbox__list .th-social-note {
  padding: 0 0.9rem;
}

.th-inbox-item {
  display: flex;
  gap: 0.65rem;
  padding: 0.65rem 0.6rem;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
}

.th-inbox-item:hover {
  background: #f1f6e6;
}

.th-inbox-item.is-active {
  background: #e7f5c8;
}

.th-inbox-item__body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}

.th-inbox-item__top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.th-inbox-item__top strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
}

.th-inbox-item__top time {
  flex-shrink: 0;
  color: var(--th-muted, #6b7564);
  font-size: 0.72rem;
}

.th-inbox-item__snippet {
  color: var(--th-muted, #6b7564);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.th-inbox-item.is-unread .th-inbox-item__top strong,
.th-inbox-item.is-unread .th-inbox-item__snippet {
  color: var(--th-ink, #111);
  font-weight: 700;
}

.th-inbox-item.is-unread .th-avatar {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #ff4d6d;
}

.th-inbox__thread {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.th-inbox__empty {
  display: grid;
  place-items: center;
  flex: 1;
  color: var(--th-muted, #6b7564);
}

.th-thread-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--th-line, #e7ebdf);
}

.th-thread-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.th-thread-head__arrow {
  color: var(--th-muted, #6b7564);
  font-weight: 400;
  margin: 0 0.2rem;
}

.th-thread-head__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.th-inbox__thread > .th-social-flash {
  margin: 0.75rem 1.1rem 0;
}

.th-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1rem 1.1rem;
  overflow-y: auto;
  max-height: 460px;
  background: #fbfcf8;
}

.th-msg {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}

.th-msg--in {
  align-self: flex-start;
}

.th-msg--out {
  align-self: flex-end;
  align-items: flex-end;
}

.th-msg__who {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--th-muted, #6b7564);
  margin-bottom: 0.2rem;
}

.th-msg__bubble {
  padding: 0.6rem 0.85rem;
  border-radius: 16px;
  font-size: 0.93rem;
  line-height: 1.45;
  word-wrap: break-word;
}

.th-msg--in .th-msg__bubble {
  background: #fff;
  border: 1px solid var(--th-line, #e7ebdf);
  border-bottom-left-radius: 4px;
}

.th-msg--you .th-msg__bubble,
.th-msg--native .th-msg__bubble {
  background: #3b82f6;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.th-msg--auto .th-msg__bubble {
  background: #e7f5c8;
  color: #1a2a05;
  border: 1px dashed #9fd428;
  border-bottom-right-radius: 4px;
}

.th-msg time {
  margin-top: 0.2rem;
  font-size: 0.68rem;
  color: var(--th-muted, #6b7564);
}

.th-composer {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.85rem 1.1rem 1rem;
  border-top: 1px solid var(--th-line, #e7ebdf);
}

.th-composer textarea,
.th-social-form textarea,
.th-rule input,
.th-inline-form input,
.th-comments__actions input,
.th-grid-2 input {
  border: 1px solid #d5dcc8;
  border-radius: 12px;
  background: #fbfcf8;
  color: var(--th-ink, #111);
  padding: 0.7rem 0.85rem;
  font: inherit;
  width: 100%;
  box-sizing: border-box;
}

.th-composer__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.th-composer__row .th-social-btn {
  width: auto;
  padding-left: 1.6rem;
  padding-right: 1.6rem;
}

.th-quick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--th-muted, #6b7564);
}

.th-quick button {
  border: 1px solid #c6e68a;
  background: #f3fbe3;
  color: #355208;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

/* Auto-reply */
.th-social-check {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.55rem;
}

.th-social-check input {
  width: auto;
}

.th-switch {
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: #f3fbe3;
  border: 1px solid #c6e68a;
}

.th-switch--master {
  padding: 1rem 1.1rem;
  margin-bottom: 0.75rem;
  border-width: 2px;
  font-size: 1.02rem;
}

.th-switch--master.is-on {
  background: #eef8d8;
  border-color: #8fbf2f;
}

.th-switch--master.is-off {
  background: #f6f6f4;
  border-color: #c8cdc0;
}

.th-switch--master small {
  display: block;
  margin-top: 0.25rem;
  font-weight: 400;
  color: var(--th-muted, #6b7564);
  font-size: 0.82rem;
}

.th-ws-head__meta .is-on { color: #3d6b00; }
.th-ws-head__meta .is-off { color: #8a3a2a; }

.th-tag--on { background: #eef8d8; color: #3d6b00; }
.th-tag--off { background: #fdecea; color: #8a3a2a; }

.th-exclude-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin: 0.5rem 0 1rem;
}

.th-exclude-set {
  border: 1px solid var(--th-line, #e7ebdf);
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 280px;
  overflow: auto;
}

.th-exclude-set legend {
  padding: 0 0.35rem;
  font-weight: 650;
  font-size: 0.88rem;
}

@media (max-width: 720px) {
  .th-exclude-grid { grid-template-columns: 1fr; }
}

.th-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.th-grid-2 label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.th-rules {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.th-rule {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 2fr auto;
  gap: 0.5rem;
  align-items: start;
}

.th-rule__remove {
  border: 1px solid var(--th-line, #e7ebdf);
  background: #fff;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  cursor: pointer;
  color: #8a1f1f;
}

.th-inline-form {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0 0.75rem;
}

.th-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.th-table th,
.th-table td {
  text-align: left;
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid var(--th-line, #e7ebdf);
  vertical-align: top;
}

.th-table th {
  color: var(--th-muted, #6b7564);
  font-weight: 600;
}

/* Comments */
.th-post {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--th-line, #e7ebdf);
}

.th-post__media img {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: 12px;
}

.th-post__caption {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  color: var(--th-muted, #6b7564);
}

.th-comments {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.th-comments li.is-hidden .th-comments__line {
  opacity: 0.55;
}

.th-comments__line {
  font-size: 0.92rem;
  line-height: 1.45;
}

.th-comments__line time {
  margin-left: 0.4rem;
  font-size: 0.72rem;
  color: var(--th-muted, #6b7564);
}

.th-comments__reply {
  margin: 0.3rem 0 0 1rem;
  padding-left: 0.6rem;
  border-left: 2px solid #c6e68a;
  font-size: 0.86rem;
}

.th-comments__actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.35rem;
}

.th-comments__actions form {
  display: flex;
  gap: 0.4rem;
  flex: 1;
}

.th-comments__actions input {
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
}

.th-comments__actions a {
  font-size: 0.82rem;
  color: #8a1f1f;
  font-weight: 600;
  text-decoration: none;
}

/* Status */
.th-status {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.45rem 1rem;
  margin: 0 0 1rem;
  font-size: 0.92rem;
}

.th-status dt {
  color: var(--th-muted, #6b7564);
  font-weight: 600;
}

.th-status dd {
  margin: 0;
}

.th-perms {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.th-perms li.is-ok span { color: #3f7a0c; font-weight: 700; }
.th-perms li.is-missing span { color: #8a1f1f; font-weight: 700; }

@media (max-width: 860px) {
  .th-inbox {
    grid-template-columns: 1fr;
  }

  .th-inbox__list {
    max-height: 320px;
    border-right: 0;
    border-bottom: 1px solid var(--th-line, #e7ebdf);
  }

  .th-grid-2,
  .th-rule {
    grid-template-columns: 1fr;
  }

  .th-msg {
    max-width: 90%;
  }
}

/* AI sales assistant */
.th-social-console-inner--wide {
  max-width: 1440px;
}

.th-inbox.has-ai {
  grid-template-columns: 280px minmax(0, 1fr) 360px;
}

.th-inbox-item__ai {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: var(--th-muted, #6b7564);
}

.th-ai-panel {
  border-left: 1px solid var(--th-line, #e7ebdf);
  background: #fff;
  padding: 0.9rem 1rem 1.1rem;
  max-height: 900px;
  overflow-y: auto;
  font-size: 0.88rem;
}

.th-ai-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.th-ai-panel__head h3 {
  margin: 0;
  font-size: 1rem;
}

.th-ai-panel__loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.6rem;
  border-radius: 10px;
  background: #f3fbe3;
  color: #355208;
  font-size: 0.82rem;
}

.th-ai-panel__loading[hidden] {
  display: none;
}

.th-ai-spinner {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border: 2px solid #c6e68a;
  border-top-color: #3f7a0c;
  border-radius: 50%;
  animation: th-ai-spin 0.8s linear infinite;
}

@keyframes th-ai-spin {
  to { transform: rotate(360deg); }
}

.th-ai-stale {
  margin: 0 0 0.6rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: #fff4d6;
  color: #7a5a00;
  font-size: 0.8rem;
}

.th-ai-block {
  margin: 0 0 0.9rem;
}

.th-ai-block h4 {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--th-muted, #6b7564);
}

/* Funnel stage bar */
.th-funnel__meter {
  height: 8px;
  border-radius: 999px;
  background: #eef0f3;
  overflow: hidden;
  margin-bottom: 0.45rem;
}

.th-funnel__meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c6e68a, #3f7a0c);
}

.th-funnel.is-lost .th-funnel__meter span {
  background: #c9ced6;
}

.th-funnel__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.2rem;
}

.th-funnel__steps li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  text-align: center;
  color: #a0a7b0;
  font-size: 0.66rem;
  line-height: 1.25;
}

.th-funnel__dot {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #eef0f3;
  color: #7a818c;
  font-size: 0.7rem;
  font-weight: 700;
}

.th-funnel__steps li.is-done {
  color: #355208;
}

.th-funnel__steps li.is-done .th-funnel__dot {
  background: #c6e68a;
  color: #1a2a05;
}

.th-funnel__steps li.is-current {
  color: var(--th-ink, #111);
  font-weight: 700;
}

.th-funnel__steps li.is-current .th-funnel__dot {
  background: #151a14;
  color: #e7f5c8;
  box-shadow: 0 0 0 3px #e7f5c8;
}

.th-funnel__lost {
  margin: 0.4rem 0 0;
  color: #8a1f1f;
  font-size: 0.78rem;
  font-weight: 600;
}

/* Lead score */
.th-ai-score {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  margin: 0 0 0.75rem;
  border-radius: 14px;
  background: #fbfcf8;
  border: 1px solid var(--th-line, #e7ebdf);
}

.th-ai-score__num strong {
  font-size: 1.9rem;
  line-height: 1;
}

.th-ai-score__num span {
  color: var(--th-muted, #6b7564);
  font-size: 0.8rem;
}

.th-ai-score__num small {
  display: block;
  color: var(--th-muted, #6b7564);
  font-size: 0.7rem;
}

.th-ai-score__bar {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #dbeafe 0%, #ffe4c2 50%, #ffd1d1 100%);
  overflow: hidden;
}

.th-ai-score__bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6 0%, #f59e0b 55%, #ef4444 100%);
}

.th-temp {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.th-temp--cold { background: #dbeafe; color: #1e3a8a; }
.th-temp--warm { background: #ffedd5; color: #9a3412; }
.th-temp--hot { background: #fee2e2; color: #991b1b; }
.th-temp--pending { background: #f3f4f6; color: #4b5563; }

.th-inbox-item__treat {
  display: block;
  font-size: 0.68rem;
  color: var(--th-muted, #6b7564);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.th-thread-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0 0;
}

.th-chip--treat { background: #fff5f4; color: #9a3412; }
.th-chip--ad { background: #eef2ff; color: #3730a3; }
.th-chip--intake-complete { background: #ecfdf5; color: #047857; }
.th-chip--intake-incomplete { background: #fff7ed; color: #c2410c; }

.th-thread-intake {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
  color: var(--th-muted, #6b7564);
}

.th-thread-intake span {
  white-space: nowrap;
}

.th-ai-treat {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.th-ai-intake {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.65rem;
  margin: 0.55rem 0 0;
  font-size: 0.84rem;
}

.th-ai-intake dt {
  margin: 0;
  color: var(--th-muted, #6b7564);
  font-weight: 600;
}

.th-ai-intake dd {
  margin: 0;
}

.th-ai-summary {
  margin: 0 0 0.75rem;
  line-height: 1.5;
}

.th-ai-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  color: var(--th-muted, #6b7564);
}

.th-ai-chips--log {
  margin: 0.3rem 0 0;
}

.th-chip {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: #eef0f3;
  color: #394150;
  font-size: 0.72rem;
  font-weight: 600;
}

.th-chip.is-current { background: #151a14; color: #e7f5c8; }
.th-chip--warn { background: #fff4d6; color: #7a5a00; }
.th-chip--script { background: #e7f5c8; color: #355208; }

.th-ai-alert {
  margin: 0 0 0.8rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  background: #fff1f1;
  color: #8a1f1f;
  font-size: 0.82rem;
}

.th-ai-alert ul {
  margin: 0.3rem 0 0;
  padding-left: 1.1rem;
}

.th-ai-next p {
  margin: 0;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  background: #f3fbe3;
  border-left: 3px solid #9fd428;
  line-height: 1.5;
}

.th-ai-psy {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 0.75rem;
  margin: 0;
}

.th-ai-psy dt {
  color: var(--th-muted, #6b7564);
  font-weight: 600;
}

.th-ai-psy dd {
  margin: 0;
  line-height: 1.45;
}

.th-ai-psy dd .th-chip {
  margin: 0.15rem 0.15rem 0 0;
}

.th-level {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.th-level i {
  width: 14px;
  height: 6px;
  border-radius: 3px;
  background: #e5e7eb;
}

.th-level--low i.is-on { background: #3b82f6; }
.th-level--medium i.is-on { background: #f59e0b; }
.th-level--high i.is-on { background: #ef4444; }

.th-level b {
  margin-left: 0.25rem;
  font-size: 0.78rem;
}

.th-ai-sugg {
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.55rem;
  border: 1px solid var(--th-line, #e7ebdf);
  border-radius: 12px;
  background: #fbfcf8;
}

.th-ai-sugg__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.35rem;
}

.th-ai-sugg__text {
  margin: 0 0 0.35rem;
  line-height: 1.5;
  white-space: normal;
}

.th-ai-sugg__why {
  margin: 0 0 0.45rem;
  color: var(--th-muted, #6b7564);
  font-size: 0.78rem;
}

.th-ai-foot {
  margin: 0.4rem 0 0;
  color: var(--th-muted, #6b7564);
  font-size: 0.72rem;
}

.th-quick--ai button {
  border-color: #151a14;
  background: #151a14;
  color: #e7f5c8;
}

/* Full-text preview on hover/focus for truncated AI / quick-reply pills */
.th-preview-tip {
  position: relative;
}

.th-preview-tip[data-preview]:hover::after,
.th-preview-tip[data-preview]:focus-visible::after,
.th-preview-tip[data-preview]:focus::after {
  content: attr(data-preview);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  width: max-content;
  max-width: min(420px, 78vw);
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: #151a14;
  color: #f4f8e8;
  font-size: 0.82rem;
  font-weight: 450;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
  box-shadow: 0 10px 28px rgba(21, 26, 20, 0.28);
  z-index: 80;
  pointer-events: none;
}

.th-preview-tip[data-preview]:hover::before,
.th-preview-tip[data-preview]:focus-visible::before,
.th-preview-tip[data-preview]:focus::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: calc(100% + 2px);
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #151a14;
  z-index: 81;
  pointer-events: none;
}

.th-quick {
  position: relative;
  z-index: 2;
}

.th-composer {
  position: relative;
  z-index: 3;
}

.th-ai-sugg .th-preview-tip[data-preview]:hover::after,
.th-ai-sugg .th-preview-tip[data-preview]:focus::after {
  left: 0;
  transform: none;
  bottom: calc(100% + 8px);
}

.th-quick[hidden] {
  display: none;
}

.th-switch--ai {
  align-items: flex-start !important;
  background: #fbfcf8;
  border-color: #d5dcc8;
  line-height: 1.5;
}

.th-switch--ai input {
  margin-top: 0.3rem;
}

.th-try-ai {
  flex-shrink: 0;
  font-size: 0.85rem;
  white-space: nowrap;
}

.th-try-reply {
  margin: 0.4rem 0 0;
  line-height: 1.5;
}

/* Insights */
.th-ai-batch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.th-ai-batch h2 {
  margin: 0 0 0.25rem;
}

.th-ai-batch .th-social-note {
  margin: 0;
}

.th-ai-batch__run {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.th-ai-batch__status {
  font-size: 0.82rem;
  color: var(--th-muted, #6b7564);
}

.th-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.th-kpi {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--th-line, #e7ebdf);
  border-radius: 16px;
  background: #fff;
}

.th-kpi span {
  color: var(--th-muted, #6b7564);
  font-size: 0.8rem;
  font-weight: 600;
}

.th-kpi strong {
  font-size: 1.7rem;
  line-height: 1.15;
}

.th-kpi small {
  color: var(--th-muted, #6b7564);
  font-size: 0.74rem;
}

.th-kpi--hot strong { color: #b91c1c; }
.th-kpi--win strong { color: #3f7a0c; }
.th-kpi--warn strong { color: #9a6700; }

.th-funnel-chart {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.th-funnel-chart__row {
  display: grid;
  grid-template-columns: 130px 1fr 210px;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
}

.th-funnel-chart__label {
  font-weight: 600;
}

.th-funnel-chart__track {
  height: 28px;
  border-radius: 8px;
  background: #f1f3f5;
  overflow: hidden;
}

.th-funnel-chart__track span {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  padding-right: 0.5rem;
  box-sizing: border-box;
  border-radius: 8px;
  color: #1a2a05;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.th-funnel-chart__row--new .th-funnel-chart__track span { background: #eef8d4; }
.th-funnel-chart__row--needs .th-funnel-chart__track span { background: #dff2b5; }
.th-funnel-chart__row--pitch .th-funnel-chart__track span { background: #c6e68a; }
.th-funnel-chart__row--objection .th-funnel-chart__track span { background: #9fd428; }
.th-funnel-chart__row--intent .th-funnel-chart__track span { background: #6fae1c; color: #fff; }
.th-funnel-chart__row--booked .th-funnel-chart__track span { background: #3f7a0c; color: #fff; }

.th-funnel-chart__num {
  color: var(--th-muted, #6b7564);
  font-size: 0.8rem;
}

.th-funnel-chart__num strong {
  color: var(--th-ink, #111);
  font-size: 0.95rem;
}

.th-funnel-chart__num em {
  margin-left: 0.35rem;
  color: #8a1f1f;
  font-style: normal;
  font-weight: 600;
}

.th-ai-cards {
  margin: 0 0 1rem;
}

.th-ai-cards .th-social-card {
  margin: 0;
}

.th-bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.th-bars li {
  display: grid;
  grid-template-columns: 130px 1fr 36px;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}

.th-bars__track {
  height: 12px;
  border-radius: 999px;
  background: #f1f3f5;
  overflow: hidden;
}

.th-bars__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #9fd428;
}

.th-bars__fill--hot { background: #ef4444; }
.th-bars__fill--warm { background: #f59e0b; }
.th-bars__fill--cold { background: #3b82f6; }
.th-bars__fill--warn { background: #f5b93b; }

.th-bars__num {
  text-align: right;
  font-weight: 700;
}

.th-ai-details summary {
  cursor: pointer;
  font-weight: 600;
}

.th-ai-details ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
}

.th-ai-table .th-funnel {
  min-width: 220px;
}

/* Script library */
.th-facts textarea,
.th-script textarea {
  border: 1px solid #d5dcc8;
  border-radius: 10px;
  background: #fbfcf8;
  padding: 0.5rem 0.65rem;
  font: inherit;
  font-size: 0.88rem;
  width: 100%;
  box-sizing: border-box;
}

.th-facts tr.is-pending td:first-child {
  color: #9a6700;
  font-weight: 600;
}

.th-script-group h3 small {
  color: var(--th-muted, #6b7564);
  font-weight: 400;
}

.th-script {
  border-top: 1px solid var(--th-line, #e7ebdf);
  padding: 0.55rem 0;
}

.th-script.is-off summary {
  opacity: 0.5;
}

.th-script summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.th-script__trigger {
  flex: 1;
  min-width: 200px;
}

.th-script__body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.6rem 0 0.2rem;
}

.th-script__meta {
  margin: 0;
  color: var(--th-muted, #6b7564);
  font-size: 0.8rem;
  line-height: 1.5;
}

.th-script__opts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.th-sticky-save {
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: 0.75rem 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 40%);
}

@media (max-width: 1180px) {
  .th-inbox.has-ai {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .th-inbox.has-ai .th-ai-panel {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--th-line, #e7ebdf);
    max-height: none;
  }
}

@media (max-width: 860px) {
  .th-inbox.has-ai {
    grid-template-columns: 1fr;
  }

  .th-kpis {
    grid-template-columns: repeat(2, 1fr);
  }

  .th-funnel-chart__row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .th-bars li {
    grid-template-columns: 100px 1fr 30px;
  }
}

/* Trust curve + analysis history */
.th-ai-trust-curve__meta {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  color: var(--th-muted, #6b7564);
}

.th-trust-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 100px;
  background: #fbfcf8;
  border: 1px solid var(--th-line, #e7ebdf);
  border-radius: 10px;
}

.th-trust-line {
  stroke: #6a9a1a;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.th-trust-dot {
  fill: #3d6b00;
}

.th-trust-axis {
  stroke: #d5dcc8;
  stroke-width: 1;
}

.th-trust-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--th-muted, #6b7564);
  margin-top: 0.2rem;
  padding: 0 0.2rem;
}

.th-ai-history__list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.th-ai-hist {
  border: 1px solid var(--th-line, #e7ebdf);
  border-radius: 10px;
  background: #fff;
  padding: 0.35rem 0.55rem;
}

.th-ai-hist summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.8rem;
}

.th-ai-hist summary::-webkit-details-marker { display: none; }

.th-ai-hist__time {
  font-weight: 650;
  min-width: 4.5rem;
}

.th-ai-hist__body {
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--th-line, #e7ebdf);
  font-size: 0.82rem;
  line-height: 1.45;
}

.th-ai-hist__body p { margin: 0 0 0.35rem; }

.th-thread-head__actions {
  flex-wrap: wrap;
  gap: 0.35rem;
}
