/* ── Contacts view ─────────────────────────────────────────────────────── */

.ct-page { max-width: 720px; margin: 0 auto; padding: 12px; }
.ct-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ct-head-title { font-size: 22px; font-weight: 700; }

.ct-rules-bar {
  background: var(--card-bg, rgba(255,255,255,.04));
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 14px; padding: 12px; margin-bottom: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.ct-rules-summary { font-size: 13px; line-height: 1.5; }
.ct-rules-line { margin-top: 4px; opacity: .9; }
.ct-rules-avoid { opacity: .75; }
.ct-apply-btn { align-self: flex-start; }

.ct-list { display: flex; flex-direction: column; gap: 10px; }
.ct-card {
  background: var(--card-bg, rgba(255,255,255,.04));
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 14px; padding: 12px; cursor: pointer;
  transition: transform .12s ease, border-color .12s ease;
}
.ct-card:active { transform: scale(.99); }
.ct-card:hover { border-color: rgba(255,255,255,.18); }
.ct-card-head { display: flex; align-items: center; gap: 10px; }
.ct-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px; color: #fff; overflow: hidden;
}
.ct-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ct-title { flex: 1 1 auto; min-width: 0; }
.ct-name { font-weight: 600; font-size: 15px; }
.ct-sub { font-size: 12px; opacity: .65; margin-top: 1px; }
.ct-badges { display: flex; gap: 6px; }
.ct-badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.ct-badge-wish { background: rgba(30,215,96,.15); color: #1ed760; }
.ct-badge-avoid { background: rgba(255,90,90,.12); color: #ff7070; }
.ct-gratis { margin-top: 8px; font-size: 12.5px; line-height: 1.5; }
.ct-gratis-avoid { opacity: .7; }
.ct-meta { margin-top: 6px; font-size: 11px; opacity: .5; }

.ct-empty, .ct-empty-big { text-align: center; opacity: .55; font-size: 13px; padding: 12px; }
.ct-empty-big { padding: 40px 12px; }
.ct-empty-emoji { font-size: 34px; margin-bottom: 8px; }
.ct-empty-sub { font-size: 12px; opacity: .7; margin-top: 4px; }

/* detail modal */
.ct-detail { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 10px; }
.ct-detail-sub { font-size: 13px; opacity: .7; }
.ct-detail-notes { font-size: 13px; opacity: .85; }
.ct-section-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; opacity: .55; margin-top: 6px; }
.ct-facts { font-size: 13px; line-height: 1.6; max-height: 180px; overflow-y: auto; }
.ct-fact { padding: 1px 0; }
.ct-chat-open { margin-top: 8px; display: flex; align-items: center; gap: 6px; justify-content: center; }

/* chips editor */
.ct-chips-editor { display: flex; flex-direction: column; gap: 12px; }
.ct-chips-label { font-size: 12px; margin-bottom: 5px; opacity: .75; }
.ct-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ct-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; padding: 4px 8px; border-radius: 20px;
  background: rgba(30,215,96,.12); color: #1ed760;
}
.ct-chip-avoid { background: rgba(255,90,90,.1); color: #ff7070; }
.ct-chip-x {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0 2px; opacity: .7;
}
.ct-chip-x:hover { opacity: 1; }
.ct-chips-add { margin-top: 6px; }
.ct-chips-add .input { width: 100%; }

/* per-contact chat sheet */
.ct-chat-backdrop {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(0,0,0,.55); backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 761px) { .ct-chat-backdrop { align-items: center; } }
.ct-chat {
  width: 100%; max-width: 560px; max-height: 82vh;
  background: var(--bg, #14161a); border-radius: 18px 18px 0 0;
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--border, rgba(255,255,255,.1));
}
@media (min-width: 761px) { .ct-chat { border-radius: 18px; max-height: 70vh; } }
.ct-chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
}
.ct-chat-title { font-weight: 700; font-size: 15px; }
.ct-chat-close {
  border: 0; background: transparent; color: inherit;
  font-size: 24px; cursor: pointer; line-height: 1; opacity: .7;
}
.ct-chat-hint { font-size: 11.5px; opacity: .55; padding: 8px 14px 0; line-height: 1.4; }
.ct-chat-msgs {
  flex: 1 1 auto; overflow-y: auto; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px; min-height: 140px;
}
.ct-msg {
  max-width: 85%; padding: 8px 12px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word;
}
.ct-msg-user { align-self: flex-end; background: rgba(30,215,96,.16); }
.ct-msg-assistant { align-self: flex-start; background: rgba(255,255,255,.07); }
.ct-msg-pending { opacity: .5; }
.ct-chat-form {
  display: flex; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--border, rgba(255,255,255,.08));
}
.ct-chat-form .input { flex: 1 1 auto; }
