/* ===== CommChannels & Marketplace page ===== */

.cm-page {
  display: grid;
  grid-template-columns: var(--clients-w) minmax(0, 1fr);
  gap: 16px;
  padding: 20px 24px;
  align-items: stretch;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
}
.cm-page-client { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1099px) {
  .cm-page { grid-template-columns: 1fr; }
  .cm-clients-panel { display: none; }
}

.cm-header-left { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cm-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
}
.cm-back-btn:hover { border-color: var(--teal); color: var(--teal); }
body[dir="rtl"] .cm-back-btn svg { transform: scaleX(-1); }

.cm-clients-panel { position: sticky; top: 16px; }

.cm-main {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.cm-main-header { flex-shrink: 0; }
.cm-main > .cm-grid,
.cm-main > .cm-list-wrap { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px 24px; }
.cm-clients-panel { align-self: stretch; height: 100%; max-height: 100%; overflow: hidden; display: flex; flex-direction: column; }
.cm-clients-panel .tm-clients-list { flex: 1; min-height: 0; overflow-y: auto; }

/* Top header inside the CommChannels / Marketplace panel — same chrome as userdetails .ud-top-bar */
.cm-ud-top-bar {
  flex-shrink: 0;
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
}
.cm-ud-top-bar .cm-main-actions { padding-inline-end: 0; }
.cm-ud-top-bar .ud-top-name { color: var(--text); }

.cm-main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.cm-client-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  background: #F3F8F5;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.cm-main-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

/* Show filter */
.cm-show { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.cm-show-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.cm-show-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  min-width: 110px;
  justify-content: space-between;
}
.cm-show-btn:hover { border-color: #d1d5db; }
.cm-show-btn.open { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,63,68,0.08); }
.cm-show-btn svg { color: var(--text-muted); transition: transform 0.15s; }
.cm-show-btn.open svg { transform: rotate(180deg); }
.cm-show-menu {
  position: absolute;
  top: calc(100% + 4px);
  inset-inline-end: 0;
  min-width: 140px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  padding: 4px;
  z-index: 50;
  display: flex;
  flex-direction: column;
}
.cm-show-menu-item {
  padding: 8px 12px;
  border: 0;
  background: transparent;
  text-align: start;
  font-size: 13px;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}
.cm-show-menu-item:hover { background: var(--bg-hover); }
.cm-show-menu-item.active { background: var(--teal-light); color: var(--teal); font-weight: 600; }

/* View toggle */
.cm-view-toggle {
  display: inline-flex;
  background: var(--bg-hover);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.cm-view-btn {
  width: 32px;
  height: 30px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
}
.cm-view-btn:hover { color: var(--text); }
.cm-view-btn.active {
  background: white;
  color: var(--teal);
  box-shadow: 0 1px 3px rgba(13,63,68,0.08);
}

/* Grid */
.cm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  grid-auto-rows: minmax(min-content, max-content);
  align-items: stretch;
  gap: 20px;
}
.cm-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== Card status tones ===== */
.cm-card {
  background: white;
  border: 1px solid #E8EAED;
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.cm-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.04); }
/* No background fills — only border color expresses status */
.cm-card-tone-active   { border-color: #104C54; }
.cm-card-tone-expired  { border-color: #FF0C0C; }
.cm-card-tone-disable  { border-color: #E8EAED; }
.cm-card-tone-paid     { border-color: #3b82f6; }
/* inactive: white bg with light border (default cm-card already matches) */

.cm-card-top {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 0;
  align-items: center;
}
.cm-card-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: white;
  border: 0;
  color: var(--teal);
  flex-shrink: 0;
}
/* icon tile — transparent, no border tint */
.cm-card-icon img,
.cm-card-icon svg { width: 24px; height: 24px; display: block; }

.cm-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.cm-card-status {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
body[dir="rtl"] .cm-card-status { align-items: flex-start; }

.cm-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.cm-pill-active   { background: transparent; color: #104C54; border: 1px solid #104C54; }
.cm-pill-expired  { background: transparent; color: #FF0C0C; border: 1px solid #FF0C0C; }
.cm-pill-disable  { background: transparent; color: #6B7280; border: 1px solid #C9CDD3; }
.cm-pill-inactive { background: transparent; color: #6B7280; border: 1px solid #C9CDD3; }

.cm-status-tag {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.cm-status-inactive { background: #E5E7EB; color: #6B7280; }
.cm-status-disable  { background: #F3F4F6; color: #6B7280; }

.cm-card-price-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
body[dir="rtl"] .cm-card-price-stack { align-items: flex-start; }
.cm-price-line {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.cm-price-line strong {
  font-size: 18px;
  font-weight: 800;
  color: var(--teal);
}

.cm-card-desc {
  font-size: 12.5px;
  line-height: 1.3;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cm-card-dates {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.6);
  border: 1px dashed rgba(0,0,0,0.08);
  border-radius: 8px;
}
/* CommChannel cards carry 4 dates (First Activation · Purchase · Paid · Renew) → 2×2 grid. */
.cm-card-dates.cm-card-dates-comm { grid-template-columns: repeat(2, 1fr); row-gap: 10px; }

.cm-date {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  min-width: 0;
}
.cm-date-label { color: var(--text-muted); font-weight: 500; }
.cm-date-value { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; gap: 4px; }
.cm-date-ico { width: 14px; height: 14px; flex-shrink: 0; display: inline-block; }

.cm-card-pending {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px 12px;
  background: #F3F8F5;
  border: 1px solid #E6EFE9;
  border-radius: 8px;
}
.cm-pend-col { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cm-pend-label { font-size: 10.5px; color: #000000; font-weight: 500; }
.cm-pend-value { font-size: 12px; color: var(--text); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }

.cm-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  justify-content: flex-end;
}
body[dir="rtl"] .cm-card-actions { justify-content: flex-end; }
.cm-btn {
  display: inline-flex;
  flex: 0 0 auto;
  align-self: flex-start;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.cm-btn-icon { display: inline-flex; align-items: center; }
.cm-btn-teal { background: var(--teal); color: white; }
.cm-btn-teal:hover { background: var(--teal-hover); }
.cm-btn-dark { background: #1F2937; color: white; }
.cm-btn-dark:hover { background: #111827; }
.cm-btn-outline-check {
  background: white;
  color: var(--teal);
  border-color: var(--teal);
}
.cm-btn-outline-check:hover { background: var(--teal-light); }

/* List view container — match hierarchy content padding */
.cm-list-wrap { padding: 4px 8px 8px; }
.cm-list-wrap .applications-page { padding: 0; }
