/* SRIDIRA CMS · WhatsApp Conversations (v9.19). Theme tokens only (tokens.css), so light / dark / system follow the CMS theme. */
.wc { --wc-r: 14px; --wc-side: 340px; --wc-info: 300px; --wc-out: var(--primary-tint); --wc-out-b: var(--primary-light);
  display: grid; grid-template-columns: minmax(270px, var(--wc-side)) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  height: clamp(520px, calc(100vh - 230px), 920px); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--wc-r); overflow: hidden; position: relative; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.wc.has-info { grid-template-columns: minmax(270px, var(--wc-side)) minmax(0, 1fr) var(--wc-info); }
.wc [hidden] { display: none !important; }
.wc-side, .wc-main, .wc-info { min-height: 0; }
.wc .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wc button { font: inherit; }
.wc :focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

/* buttons */
.wc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-primary); font-size: var(--text-sm); font-weight: 600; padding: 7px 12px; cursor: pointer;
  transition: background .15s, border-color .15s; white-space: nowrap; }
.wc-btn:hover { background: var(--surface-tertiary); }
.wc-btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.wc-btn.primary:hover { background: var(--primary-hover); }
.wc-btn.ghost { background: transparent; }
.wc-btn.sm { padding: 5px 10px; font-size: var(--text-xs); }
.wc-btn.block { width: 100%; margin-top: 14px; }
.wc-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent;
  color: var(--text-secondary); cursor: pointer; }
.wc-icon:hover { background: var(--surface-tertiary); color: var(--text-primary); }
.wc-switch { display: flex; justify-content: flex-end; margin-bottom: 10px; }

/* avatars */
.wc-av { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  color: var(--primary); background: var(--primary-light); letter-spacing: .02em; }
.wc-av.lg { width: 42px; height: 42px; }
.wc-av.xl { width: 64px; height: 64px; font-size: 20px; }
.wc-av.sk { background: var(--surface-tertiary); }

/* ───── left: conversations ───── */
.wc-side { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--border); background: var(--surface); }
.wc-side-head { padding: 14px 14px 10px; display: grid; gap: 10px; border-bottom: 1px solid var(--border-subtle); }
.wc-side-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wc-h { margin: 0; font-size: var(--text-lg); font-weight: 700; color: var(--text-primary); }
.wc-acts { display: flex; gap: 6px; }
.wc-search { display: flex; align-items: center; gap: 8px; background: var(--surface-tertiary); border-radius: 10px; padding: 0 10px;
  border: 1px solid transparent; transition: border-color .15s, background .15s; }
.wc-search:focus-within { border-color: var(--border-focus); background: var(--surface); }
.wc-search-ico { color: var(--text-tertiary); display: flex; }
.wc-search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 9px 0; font-size: var(--text-sm); color: var(--text-primary); outline: none; box-shadow: none; }
.wc-filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.wc-filters::-webkit-scrollbar { display: none; }
.wc-chip { flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); border-radius: 999px;
  padding: 5px 11px; font-size: var(--text-xs); font-weight: 600; cursor: pointer; display: inline-flex; gap: 5px; align-items: center; }
.wc-chip:hover { color: var(--text-primary); border-color: var(--border-strong); }
.wc-chip.is-on { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.wc-chip-n { font-variant-numeric: tabular-nums; opacity: .85; }
.wc-exec select { width: 100%; }
.wc-list-wrap { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.wc-list { list-style: none; margin: 0; padding: 4px 0; }
.wc-item { width: 100%; display: flex; gap: 12px; align-items: flex-start; text-align: left; border: 0; background: transparent; padding: 11px 14px;
  cursor: pointer; border-left: 3px solid transparent; color: var(--text-primary); transition: background .12s; }
.wc-item:hover { background: var(--surface-secondary); }
.wc-item.is-active { background: var(--primary-tint); border-left-color: var(--primary); }
.wc-it { flex: 1; min-width: 0; display: grid; gap: 3px; }
.wc-it-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.wc-it-name { font-weight: 600; font-size: var(--text-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-it-time { flex: none; font-size: var(--text-2xs); color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.wc-item.is-unread .wc-it-time { color: var(--primary); font-weight: 700; }
.wc-it-prev { font-size: var(--text-sm); color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-item.is-unread .wc-it-prev { color: var(--text-primary); }
.wc-pv-k { color: var(--text-tertiary); font-weight: 600; }
.wc-pv-k.in { color: var(--success-text); }
.wc-pv-k.req { color: var(--warning-text); display: inline-flex; gap: 3px; align-items: center; vertical-align: -2px; }
.wc-it-meta { display: flex; gap: 6px; align-items: center; min-width: 0; }
.wc-it-sub { flex: 1; min-width: 0; font-size: var(--text-2xs); color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-unread { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--primary); color: var(--primary-contrast);
  font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.wc-pill { flex: none; font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 2px 8px; white-space: nowrap; letter-spacing: .01em; vertical-align: 2px; }
.wc-pill.amber { background: var(--warning-bg); color: var(--warning-text); }
.wc-pill.blue { background: var(--primary-light); color: var(--primary-active); }
.wc-pill.green { background: var(--success-bg); color: var(--success-text); }
.wc-pill.red { background: var(--danger-bg); color: var(--danger-text); }
.wc-pill.grey { background: var(--neutral-bg); color: var(--neutral-text); }
.wc-list-empty { padding: 36px 18px; text-align: center; color: var(--text-secondary); display: grid; gap: 12px; justify-items: center; font-size: var(--text-sm); }
.wc-more { padding: 6px 14px 16px; display: flex; justify-content: center; }
.wc-skel { display: flex; gap: 12px; padding: 12px 14px; }
.wc-skel-lines { flex: 1; display: grid; gap: 8px; padding-top: 4px; }
.wc-skel-lines i, .wc-skel-thread i, .wc-skel-info i { display: block; height: 11px; border-radius: 6px; background: var(--surface-tertiary); animation: wcPulse 1.3s ease-in-out infinite; }
.wc-skel-lines i:last-child { width: 70%; }
.wc-av.sk { animation: wcPulse 1.3s ease-in-out infinite; }
@keyframes wcPulse { 50% { opacity: .45; } }

/* ───── centre: conversation ───── */
.wc-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface-secondary); }
.wc-blank { margin: auto; text-align: center; max-width: 340px; padding: 24px; color: var(--text-secondary); display: grid; gap: 8px; justify-items: center; }
.wc-blank h3 { margin: 8px 0 0; color: var(--text-primary); font-size: var(--text-lg); }
.wc-blank p { margin: 0; font-size: var(--text-sm); }
.wc-blank-art { display: grid; gap: 7px; width: 120px; }
.wc-blank-art span { height: 18px; border-radius: 10px; background: var(--primary-light); }
.wc-blank-art span:nth-child(1) { width: 70%; }
.wc-blank-art span:nth-child(2) { width: 82%; justify-self: end; background: var(--surface-tertiary); }
.wc-blank-art span:nth-child(3) { width: 55%; }
.wc-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--border); min-height: 64px; }
.wc-back { display: none; margin-left: -6px; }
.wc-head-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.wc-head-name { font-weight: 700; font-size: var(--text-md); color: var(--text-primary); display: flex; align-items: center; gap: 8px; min-width: 0; }
.wc-head-nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.wc-head-sub { font-size: var(--text-xs); color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-head-acts { display: flex; align-items: center; gap: 4px; flex: none; }
.wc-thread { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.wc-thread:focus-visible { outline-offset: -2px; }
.wc-prov { align-self: center; max-width: 560px; text-align: center; font-size: var(--text-xs); color: var(--warning-text); background: var(--warning-bg);
  border: 1px solid var(--warning-border); border-radius: 10px; padding: 7px 12px; margin-bottom: 6px; line-height: 1.45; }
.wc-older-wrap { display: flex; justify-content: center; margin-bottom: 4px; }
.wc-day { display: flex; justify-content: center; margin: 10px 0 4px; position: sticky; top: -14px; z-index: 1; }
.wc-day span { font-size: var(--text-2xs); font-weight: 700; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border-subtle);
  border-radius: 8px; padding: 3px 10px; box-shadow: 0 1px 2px rgba(15, 23, 42, .06); letter-spacing: .02em; }
.wc-row { display: flex; }
.wc-row.out { justify-content: flex-end; }
.wc-b { max-width: min(78%, 560px); border-radius: 14px; padding: 8px 11px 6px; font-size: var(--text-base); line-height: 1.5; color: var(--text-primary);
  box-shadow: 0 1px 1.5px rgba(15, 23, 42, .08); display: grid; gap: 4px; position: relative; overflow-wrap: anywhere; }
.wc-b.in { background: var(--surface); border-top-left-radius: 4px; }
.wc-b.msg { background: var(--wc-out); border: 1px solid var(--wc-out-b); border-top-right-radius: 4px; }
.wc-b.req { background: var(--surface); border: 1.5px dashed var(--wc-out-b); border-top-right-radius: 4px; box-shadow: none; }
.wc-row.is-new .wc-b { animation: wcNew 2.4s ease-out; }
@keyframes wcNew { 0% { box-shadow: 0 0 0 4px var(--primary-ring); } 100% { box-shadow: 0 0 0 0 transparent; } }
.wc-tag { font-size: var(--text-2xs); font-weight: 700; color: var(--warning-text); display: flex; align-items: center; gap: 4px; letter-spacing: .02em; }
.wc-tag.in { color: var(--success-text); }
.wc-text { white-space: normal; }
.wc-meta { font-size: var(--text-xs); color: var(--text-secondary); }
.wc-pri { color: var(--danger-text); }
.wc-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-size: var(--text-2xs); color: var(--text-tertiary); flex-wrap: wrap; }
.wc-foot time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.wc-src { margin-right: auto; }
.wc-state { margin-right: auto; font-weight: 600; }
.wc-state.s-requested { color: var(--warning-text); }
.wc-state.s-in-progress, .wc-state.s-message-sent { color: var(--primary-active); }
.wc-state.s-customer-replied { color: var(--success-text); }
.wc-state.s-unable-to-send { color: var(--danger-text); }
.wc-edited { border: 0; background: none; padding: 0; color: var(--text-tertiary); font-size: inherit; text-decoration: underline dotted; cursor: help; }
.wc-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.wc-cat { font-size: 10.5px; font-weight: 600; border-radius: 6px; padding: 1px 7px; background: var(--neutral-bg); color: var(--neutral-text); }
.wc-cat.fu { background: var(--info-bg); color: var(--info-text); }
.wc-note { font-size: var(--text-xs); color: var(--text-secondary); border-top: 1px dashed var(--border); padding-top: 4px; }
.wc-note summary { cursor: pointer; font-weight: 600; }
.wc-note p { margin: 4px 0 0; white-space: pre-wrap; }
.wc-ev { display: flex; justify-content: center; margin: 4px 0; }
.wc-ev span { font-size: var(--text-2xs); color: var(--text-secondary); background: var(--surface-tertiary); border-radius: 8px; padding: 3px 10px; text-align: center; max-width: 90%; }
.wc-thread-msg { margin: auto; text-align: center; color: var(--text-secondary); font-size: var(--text-sm); padding: 20px; }
.wc-skel-thread { display: grid; gap: 12px; padding: 10px 0; }
.wc-skel-thread i { height: 40px; width: 48%; border-radius: 14px; }
.wc-skel-thread i.r { justify-self: end; width: 40%; }
.wc-skel-thread i.w { width: 62%; }

/* composer */
.wc-compose { background: var(--surface); border-top: 1px solid var(--border); padding: 8px 14px 10px; display: grid; gap: 6px; }
.wc-cmeta { font-size: var(--text-xs); color: var(--text-secondary); }
.wc-cmeta summary { cursor: pointer; display: flex; gap: 8px; align-items: center; list-style: none; padding: 2px 0; }
.wc-cmeta summary::-webkit-details-marker { display: none; }
.wc-cmeta summary b { color: var(--text-primary); font-weight: 600; }
.wc-cmeta-edit { color: var(--text-link); font-weight: 600; margin-left: auto; }
.wc-cmeta[open] .wc-cmeta-edit { visibility: hidden; }
.wc-cmeta-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, .7fr); gap: 8px; padding: 6px 0 4px; }
.wc-cmeta label, .wc-other { display: grid; gap: 3px; font-size: var(--text-2xs); font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; min-width: 0; }
.wc-cmeta select, .wc-other input { width: 100%; min-width: 0; text-transform: none; letter-spacing: 0; font-size: var(--text-sm); }
.wc-other { margin-bottom: 4px; }
.wc-crow { display: flex; gap: 8px; align-items: flex-end; }
.wc-crow textarea { flex: 1; min-width: 0; resize: none; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; font: inherit;
  font-size: var(--text-base); line-height: 1.45; background: var(--surface-secondary); color: var(--text-primary); max-height: 160px; min-height: 44px; }
.wc-crow textarea:focus { border-color: var(--border-focus); background: var(--surface); outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.wc-send { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 44px; padding: 0 16px; border-radius: 12px; border: 0;
  background: var(--primary); color: var(--primary-contrast); font-weight: 700; font-size: var(--text-sm); cursor: pointer; transition: background .15s; }
.wc-send:hover { background: var(--primary-hover); }
.wc-send:disabled { opacity: .6; cursor: progress; }
.wc-help { display: flex; justify-content: space-between; gap: 10px; font-size: var(--text-2xs); color: var(--text-tertiary); line-height: 1.4; }
.wc-help kbd { font-family: var(--font-mono); font-size: 10px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--surface-secondary); }
.wc-words { flex: none; font-variant-numeric: tabular-nums; }
.wc-words.near { color: var(--warning-text); }
.wc-words.over { color: var(--danger-text); font-weight: 700; }
.wc-ro { background: var(--surface); border-top: 1px solid var(--border); padding: 12px 16px; font-size: var(--text-sm); color: var(--text-secondary); text-align: center; }
.wc-ro.warn { color: var(--warning-text); background: var(--warning-bg); }

/* ───── right: customer details ───── */
.wc-info { border-left: 1px solid var(--border); background: var(--surface); overflow-y: auto; min-width: 0; }
.wc-info-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 8px 16px; border-bottom: 1px solid var(--border-subtle); min-height: 64px; }
.wc-info-head h4 { margin: 0; font-size: var(--text-md); }
.wc-info-body { padding: 14px 16px 20px; }
.wc-info-id { display: grid; justify-items: center; gap: 4px; text-align: center; margin-bottom: 14px; }
.wc-info-id b { font-size: var(--text-md); }
.wc-info-id .muted { font-size: var(--text-xs); }
.wc-kvs { margin: 0; display: grid; gap: 0; }
.wc-kv { display: grid; gap: 2px; padding: 9px 0; border-bottom: 1px solid var(--border-subtle); }
.wc-kv dt { font-size: var(--text-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-tertiary); }
.wc-kv dd { margin: 0; font-size: var(--text-sm); color: var(--text-primary); }
.wc-skel-info { display: grid; gap: 12px; }

/* ───── narrower desktops: details slide over the chat ───── */
@media (max-width: 1180px) {
  .wc, .wc.has-info { grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); }
  .wc-info { position: absolute; right: 0; top: 0; bottom: 0; width: min(320px, 90%); z-index: 5; box-shadow: -12px 0 32px rgba(15, 23, 42, .18); }
}
/* ───── phones: list first, then a full-width chat ───── */
@media (max-width: 760px) {
  .wc, .wc.has-info { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 150px); height: calc(100dvh - 150px); min-height: 460px; border-radius: 12px; }
  .wc[data-pane="list"] .wc-main { display: none; }
  .wc[data-pane="chat"] .wc-side { display: none; }
  .wc-side { border-right: 0; }
  .wc-back { display: inline-grid; }
  .wc-head { padding: 8px 8px 8px 10px; gap: 8px; min-height: 58px; }
  .wc-av.lg { width: 36px; height: 36px; }
  #wcProfile { display: none; }
  .wc-thread { padding: 10px 10px 14px; }
  .wc-b { max-width: 88%; }
  .wc-compose { padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .wc-cmeta-grid { grid-template-columns: minmax(0, 1fr); }
  .wc-send span { display: none; }
  .wc-send { width: 44px; padding: 0; justify-content: center; border-radius: 50%; }
  .wc-help > span:first-child { display: none; }
  .wc-item { padding: 12px; min-height: 64px; }
  .wc-info { width: 100%; }
  .wc-acts .wc-btn { padding: 6px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .wc *, .wc *::before { animation: none !important; transition: none !important; }
}
