/* Wesal V2 — Customer Core Foundation + Customer 360 Phase 1 (2026-09-18).
   Tokens only (tokens.css) — same discipline as customers.css, so light/dark
   need no second stylesheet. Layout mirrors customers.css's two-pane
   master/detail structure deliberately (same product, same shell), scoped
   under its own cc- prefix so nothing here can leak into that screen. */

.cc-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.cc-wrap:has(.cc-detail:not(.cc-detail-empty)) {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
}

@media (max-width: 900px) {
  .cc-wrap, .cc-wrap:has(.cc-detail:not(.cc-detail-empty)) {
    grid-template-columns: minmax(0, 1fr);
  }
  .cc-wrap.show-detail .cc-list-panel {
    display: none;
  }
  .cc-wrap:not(.show-detail) .cc-detail {
    display: none;
  }
}

.cc-list-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  border-inline-end: 1px solid var(--w-line);
  padding: 16px 20px;
}

.cc-list-header h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: var(--w-ink);
}
.cc-subtitle {
  margin: 4px 0 12px;
  color: var(--w-ink-3);
  font-size: 13px;
}

.cc-search {
  margin-bottom: 12px;
}
.cc-search .input {
  width: 100%;
}

.cc-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--w-line);
  border-radius: 10px;
  overflow: hidden;
}

.cc-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 12px;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--w-ink-3);
  border-bottom: 1px solid var(--w-line);
}

.cc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--w-line);
  color: var(--w-ink);
  text-decoration: none;
}
.cc-row:last-child { border-bottom: none; }
.cc-row:hover { background: var(--w-surface-2); }

.cc-row-name {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cc-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cc-row-title {
  font-weight: 600;
  color: var(--w-ink);
}
.cc-row-phone {
  color: var(--w-ink-3);
  font-size: 12px;
}
.cc-row-activity {
  color: var(--w-ink-3);
  font-size: 13px;
  align-self: center;
}

@media (max-width: 900px) {
  .cc-head { display: none; }
  .cc-row { grid-template-columns: 1fr; gap: 6px; }
}

.cc-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.cc-pager-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cc-pager-size-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cc-pager select.input {
  width: auto;
  max-width: 140px;
  padding: 3px 8px;
  font-size: 12px;
}

.cc-skeleton, .cc-skel-row {
  border-radius: 8px;
  background: var(--w-surface-2);
}
.cc-skel-row {
  height: 44px;
  margin-bottom: 8px;
}

.cc-empty, .cc-error {
  padding: 24px 12px;
  text-align: center;
  color: var(--w-ink-3);
}

/* ==================== detail / profile ==================== */

.cc-detail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  padding: 16px 20px;
  gap: 16px;
}
.cc-detail-empty { display: none; }

.cc-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.cc-back-link {
  color: var(--w-ink-3);
  text-decoration: none;
  font-size: 13px;
}
.cc-back-link:hover { color: var(--w-ink); }

.cc-ref-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--w-surface-2);
  border: 1px solid var(--w-line);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
}
.cc-ref-label {
  color: var(--w-ink-3);
}
.cc-ref-code {
  font-family: monospace;
  font-weight: 700;
  color: var(--w-ink);
}
.cc-copy-btn {
  padding: 1px 6px;
  font-size: 11px;
}

.cc-detail-header {
  border-bottom: 1px solid var(--w-line);
  padding-bottom: 12px;
}

.cc-detail-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
}
.cc-detail-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--w-ink);
  min-width: 0;
  word-break: break-word;
}

.cc-stage-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.cc-stage-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--w-ink-3);
  white-space: nowrap;
}
.cc-stage-select {
  font-weight: 600;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
}

.cc-detail-phone, .cc-detail-email {
  margin: 4px 0 0;
  color: var(--w-ink-3);
  font-size: 13px;
}

/* Lifecycle Stage Chips */
.cc-stage-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-block;
}
.cc-stage-chip.cc-stage-new, .cc-stage-select.cc-stage-new {
  background: var(--w-surface-2);
  color: var(--w-ink-2);
  border: 1px solid var(--w-line);
}
.cc-stage-chip.cc-stage-lead, .cc-stage-select.cc-stage-lead {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.cc-stage-chip.cc-stage-customer, .cc-stage-select.cc-stage-customer {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.cc-stage-chip.cc-stage-inactive, .cc-stage-select.cc-stage-inactive {
  background: var(--w-surface-2);
  color: var(--w-ink-3);
  border: 1px solid var(--w-line);
}

.cc-card {
  border: 1px solid var(--w-line);
  border-radius: 10px;
  padding: 12px 14px;
}
.cc-card h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--w-ink-2);
}

/* Connected Channels / Identities */
.cc-identities {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cc-identity-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--w-line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--w-surface);
}
.cc-id-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cc-id-badge-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cc-id-provider {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--w-surface-2);
  color: var(--w-ink);
}
.cc-id-status {
  font-size: 11px;
  font-weight: 600;
}
.cc-id-status.cc-status-active {
  color: #047857;
}
.cc-id-status.cc-status-resolved {
  color: var(--w-ink-3);
}
.cc-id-source {
  font-size: 11px;
  color: var(--w-ink-3);
}
.cc-id-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.cc-id-main {
  font-size: 13px;
}
.cc-id-assignee {
  color: var(--w-ink-3);
  font-size: 12px;
}
.cc-id-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.cc-open-conv {
  font-weight: 600;
}

.cc-provider-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--w-surface-2);
  color: var(--w-ink-3);
  font-size: 11px;
  margin-inline-start: 4px;
}

/* Internal Note Composer */
.cc-note-composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cc-note-input {
  width: 100%;
  resize: vertical;
  min-height: 56px;
  font-size: 13px;
}
.cc-note-actions {
  display: flex;
  justify-content: flex-end;
}

/* Tags */
.cc-tags-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cc-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
}
.cc-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--w-ink-3);
  padding: 0 2px;
  font-size: 14px;
  line-height: 1;
}
.cc-tag-remove:hover {
  color: var(--w-ink);
}
.cc-tag-add-wrap {
  display: flex;
  align-items: center;
}
.cc-tag-select {
  font-size: 12px;
}
.cc-empty-inline {
  margin: 0;
  color: var(--w-ink-3);
  font-size: 12px;
}

/* Timeline & Filters */
.cc-tl-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.cc-tl-filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex-wrap: nowrap;
  padding: 2px 2px 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.cc-tl-filters::-webkit-scrollbar {
  display: none;
}
.cc-tl-pill {
  border: 1px solid var(--w-line);
  background: var(--w-surface);
  color: var(--w-ink-2);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.cc-tl-pill:hover {
  background: var(--w-surface-2);
  color: var(--w-ink);
}
.cc-tl-pill.active {
  background: var(--w-ink);
  color: var(--w-surface);
  border-color: var(--w-ink);
  font-weight: 600;
}

.cc-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}
.cc-tl-entry {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  font-size: 13px;
}
.cc-tl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--w-brand, var(--w-ink-3));
  margin-top: 6px;
}
.cc-tl-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.cc-tl-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cc-tl-label {
  color: var(--w-ink);
  font-weight: 600;
}
.cc-tl-actor {
  color: var(--w-ink-3);
  font-size: 11px;
}
.cc-tl-time {
  color: var(--w-ink-3);
  font-size: 12px;
  margin-inline-start: auto;
  white-space: nowrap;
}
.cc-tl-note-body {
  margin: 4px 0 0 0;
  padding: 6px 10px;
  background: var(--w-surface-2);
  border-inline-start: 3px solid var(--w-brand, #2563eb);
  border-radius: 4px;
  font-size: 12px;
  color: var(--w-ink);
  white-space: pre-wrap;
  line-height: 1.4;
}
.cc-tl-msg-preview {
  font-size: 12px;
  color: var(--w-ink-2);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cc-tl-meta-preview {
  font-size: 12px;
  color: var(--w-ink-3);
}
.cc-tl-more-btn {
  width: 100%;
  margin-top: 12px;
}
