/* ===========================================================================
   dashboard.css — interactive "Live Operations" product preview (Solution 01)
   A faithful recreation of the CurveCare dashboard, built in HTML/CSS (no image).
   All tokens are scoped to .dash so the product's own indigo palette never leaks
   into the surrounding Apple-monochrome page. Supports a light + dark theme.
   =========================================================================== */

.dash-stage {
  margin: clamp(40px, 6vw, 72px) auto 0;
  max-width: 1120px;
  perspective: 1600px;
}

.dash {
  /* scoped product palette — light */
  --d-bg: #ffffff;
  --d-soft: #f6f6f8;
  --d-soft2: #fafafb;
  --d-line: #ececef;
  --d-text: #1b1b1f;
  --d-text2: #6c6c75;
  --d-text3: #9a9aa3;
  --d-accent: #0A3C6F;            /* Trio Deep Tech Blue */
  --d-accent-soft: #e7edf6;
  --d-green: #15a35a;  --d-green-soft: #e4f6ec;
  --d-amber: #c98a05;  --d-amber-soft: #fcf1d6;
  --d-blue: #2f6df6;

  position: relative;
  border: 1px solid var(--d-line);
  border-radius: 16px;
  background: var(--d-bg);
  color: var(--d-text);
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,.04), 0 30px 70px -30px rgba(20,20,40,.4);
  transition: box-shadow .4s var(--ease), background .4s ease, color .4s ease, border-color .4s ease;
  font-size: 14px;
}
.dash[data-theme="dark"] {
  --d-bg: #0e0e11;
  --d-soft: #17171b;
  --d-soft2: #131316;
  --d-line: #26262c;
  --d-text: #f3f3f6;
  --d-text2: #9a9aa4;
  --d-text3: #6d6d77;
  --d-accent: #5b9bd8;            /* lighter Trio blue for the dark theme */
  --d-accent-soft: #11233a;
  --d-green: #34d27b;  --d-green-soft: #102a1d;
  --d-amber: #e7b53e;  --d-amber-soft: #2c2510;
  --d-blue: #5b8cff;
}

/* ------------------------------ title bar ------------------------------- */
.dash-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 46px;
  padding: 0 14px;
  background: var(--d-soft);
  border-bottom: 1px solid var(--d-line);
}
.dash-dots { display: inline-flex; gap: 7px; }
.dash-dots i { width: 11px; height: 11px; border-radius: 50%; background: #dadade; }
.dash[data-theme="dark"] .dash-dots i { background: #34343c; }
.dash-bar-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--d-text2);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-bar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.dash-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--d-text);
  background: var(--d-bg);
  border: 1px solid var(--d-line);
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s, transform .2s;
}
.dash-chip:hover { border-color: var(--d-text3); transform: translateY(-1px); }
.dash-chip svg { width: 15px; height: 15px; }
.dash-chip[data-live] .dash-live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--d-green);
  box-shadow: 0 0 0 0 rgba(21,163,90,.5);
  animation: dashPulse 1.8s ease-out infinite;
}
.dash-chip[data-live].is-paused { color: var(--d-text2); }
.dash-chip[data-live].is-paused .dash-live-dot { background: var(--d-text3); animation: none; box-shadow: none; }

.dash-icon {
  display: inline-grid;
  place-items: center;
  width: 30px; height: 30px;
  background: var(--d-bg);
  border: 1px solid var(--d-line);
  border-radius: 8px;
  color: var(--d-text);
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.dash-icon:hover { border-color: var(--d-text3); }
.dash-icon svg { width: 16px; height: 16px; }
.dash-icon .ico-sun { display: none; }
.dash[data-theme="dark"] .dash-icon .ico-moon { display: none; }
.dash[data-theme="dark"] .dash-icon .ico-sun { display: block; }

/* -------------------------------- body ---------------------------------- */
.dash-body { display: grid; grid-template-columns: 232px 1fr; }

/* sidebar */
.dash-side {
  border-right: 1px solid var(--d-line);
  background: var(--d-soft2);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 540px;
}
.dash-brand { display: flex; align-items: center; gap: 10px; padding: 2px 4px 10px; }
.dash-logo {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(150deg, #155291, #0A3C6F);
}
.dash-logo svg { width: 20px; height: 20px; }
.dash-brand-txt, .dash-org-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.dash-brand-txt b { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.dash-brand-txt small, .dash-org-txt small { font-size: 11.5px; color: var(--d-text2); }

.dash-org {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  background: var(--d-bg);
  border: 1px solid var(--d-line);
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: var(--d-text);
}
.dash-org-mark {
  flex: none; display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--d-accent-soft); color: var(--d-accent);
  font-size: 12px; font-weight: 700;
}
.dash-org-txt b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-org svg { width: 16px; height: 16px; margin-left: auto; color: var(--d-text3); }

.dash-nav { display: flex; flex-direction: column; gap: 2px; }
.dash-nav-h {
  margin: 12px 8px 4px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--d-text3);
}
.dash-navi {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 13.5px; font-weight: 500;
  color: var(--d-text2);
  cursor: pointer;
  transition: background .18s, color .18s;
}
.dash-navi svg { width: 18px; height: 18px; flex: none; }
.dash-navi:hover { background: var(--d-soft); color: var(--d-text); }
.dash-navi.is-active { background: var(--d-accent-soft); color: var(--d-accent); font-weight: 600; }
.dash-badge {
  margin-left: auto;
  min-width: 18px; height: 18px; padding: 0 5px;
  display: none; place-items: center;
  font-size: 11px; font-weight: 600;
  border-radius: 9px;
  background: var(--d-accent); color: #fff;
}
.dash-badge.show { display: inline-grid; }

.dash-user {
  margin-top: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  background: var(--d-bg);
  border: 1px solid var(--d-line);
  border-radius: 10px;
}
.dash-ava, .dash-row-ava {
  flex: none; display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(150deg, #155291, #0A3C6F);
  color: #fff; font-size: 12px; font-weight: 600;
}
.dash-user .dash-org-txt b { font-size: 13px; }

/* main */
.dash-main { padding: clamp(16px, 2vw, 26px); background: var(--d-bg); overflow: hidden; }
.dash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dash-head h4 { font-size: clamp(20px, 2.4vw, 27px); font-weight: 600; letter-spacing: -0.025em; }
.dash-head p { margin-top: 5px; font-size: 13px; color: var(--d-text2); }

/* metric cards */
.dash-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 20px;
}
.dash-metric {
  border: 1px solid var(--d-line);
  border-radius: 12px;
  padding: 16px;
  background: var(--d-bg);
}
.dash-metric-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dash-metric-top span:first-child {
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--d-text2);
}
.dash-mi { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; }
.dash-mi svg { width: 16px; height: 16px; }
.dash-mi--indigo { background: var(--d-accent-soft); color: var(--d-accent); }
.dash-mi--amber { background: var(--d-amber-soft); color: var(--d-amber); }
.dash-mi--green { background: var(--d-green-soft); color: var(--d-green); }
.dash-metric-num {
  margin: 10px 0 8px;
  font-size: clamp(28px, 3.4vw, 38px);
  font-weight: 600; letter-spacing: -0.03em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.dash-metric-sub { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--d-text2); }
.dash-metric-sub svg { width: 14px; height: 14px; }
.dash-metric-sub.dash-up { color: var(--d-green); }

/* panels */
.dash-panel {
  margin-top: 16px;
  border: 1px solid var(--d-line);
  border-radius: 12px;
  background: var(--d-bg);
  overflow: hidden;
}
.dash-panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px;
}
.dash-panel-head b { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.dash-panel-head .dash-sub { font-size: 12.5px; color: var(--d-text2); }
.dash-livecount {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--d-text2);
}
.dash-livecount .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--d-text3);
}
.dash-livecount.live .dot { background: var(--d-green); animation: dashPulse 1.8s ease-out infinite; }
.dash-viewall { margin-left: auto; font-size: 12.5px; font-weight: 500; color: var(--d-accent); cursor: pointer; }

/* empty states */
.dash-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  text-align: center;
  border-top: 1px solid var(--d-line);
}
.dash-empty .dash-empty-ic {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--d-soft); color: var(--d-text3);
}
.dash-empty .dash-empty-ic svg { width: 22px; height: 22px; }
.dash-empty b { font-size: 15px; font-weight: 600; }
.dash-empty span { font-size: 13px; color: var(--d-text2); max-width: 34ch; }

/* call rows */
.dash-calls { border-top: 1px solid var(--d-line); }
.dash-call {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--d-line);
}
.dash-call:last-child { border-bottom: none; }
.dash-call-ic {
  flex: none; display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--d-accent-soft); color: var(--d-accent);
}
.dash-call-ic svg { width: 17px; height: 17px; }
.dash-call-txt { min-width: 0; }
.dash-call-txt b { font-size: 13.5px; font-weight: 600; }
.dash-call-txt span { display: block; font-size: 12px; color: var(--d-text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-call-meta { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.dash-wave { display: inline-flex; align-items: center; gap: 2px; height: 16px; }
.dash-wave i { width: 2px; background: var(--d-accent); border-radius: 2px; animation: dashWave 1s ease-in-out infinite; }
.dash-wave i:nth-child(1){ height: 6px; animation-delay: 0s; }
.dash-wave i:nth-child(2){ height: 13px; animation-delay: .15s; }
.dash-wave i:nth-child(3){ height: 9px; animation-delay: .3s; }
.dash-wave i:nth-child(4){ height: 15px; animation-delay: .45s; }
.dash-wave i:nth-child(5){ height: 7px; animation-delay: .6s; }
.dash-dur { font-size: 12.5px; font-weight: 600; color: var(--d-text); font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }

/* conversation rows */
.dash-convos { border-top: 1px solid var(--d-line); }
.dash-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--d-line);
}
.dash-row:last-child { border-bottom: none; }
.dash-ch {
  flex: none; display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 6px;
}
.dash-ch svg { width: 14px; height: 14px; }
.dash-ch--whatsapp { background: rgba(37,211,102,.14); color: #1faa52; }
.dash-ch--instagram { background: rgba(214,41,118,.13); color: #c52d77; }
.dash-ch--sms { background: rgba(47,109,246,.13); color: var(--d-blue); }
.dash-ch--facebook { background: rgba(24,119,242,.13); color: #1877f2; }
.dash-row-name { font-size: 13.5px; font-weight: 600; flex: none; }
.dash-row-msg { font-size: 13px; color: var(--d-text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-row-meta { margin-left: auto; display: flex; align-items: center; gap: 12px; flex: none; }
.dash-time { font-size: 12px; color: var(--d-text3); }
.dash-tag {
  font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
  padding: 3px 9px; border-radius: 999px;
}
.dash-tag--resolved { background: var(--d-green-soft); color: var(--d-green); }
.dash-tag--escalated { background: var(--d-amber-soft); color: var(--d-amber); }
.dash-tag--new { background: var(--d-accent-soft); color: var(--d-accent); }
.dash-tag--replying { background: var(--d-accent-soft); color: var(--d-accent); display: inline-flex; align-items: center; gap: 6px; }
.dash-typing { display: inline-flex; gap: 3px; }
.dash-typing i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: dashType 1.2s infinite; }
.dash-typing i:nth-child(2){ animation-delay: .2s; }
.dash-typing i:nth-child(3){ animation-delay: .4s; }

/* row entrance */
.dash-rowin { animation: dashRowIn .45s var(--ease) both; }

/* ------------------------------ keyframes ------------------------------- */
@keyframes dashPulse {
  0%   { box-shadow: 0 0 0 0 rgba(21,163,90,.45); }
  70%  { box-shadow: 0 0 0 6px rgba(21,163,90,0); }
  100% { box-shadow: 0 0 0 0 rgba(21,163,90,0); }
}
@keyframes dashType { 0%,60%,100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
@keyframes dashWave { 0%,100% { transform: scaleY(.5); } 50% { transform: scaleY(1); } }
@keyframes dashRowIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.dash-cap {
  margin-top: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
}

/* ------------------------------ responsive ------------------------------ */
@media (max-width: 860px) {
  .dash-body { grid-template-columns: 1fr; }
  .dash-side { display: none; }
  .dash-metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .dash { font-size: 13px; }
  .dash-metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .dash-metric { padding: 12px; }
  .dash-bar-title { display: none; }
  .dash-row-msg { display: none; }
  .dash-call-txt span { max-width: 36vw; }
}
