/* ============================================================
   Calldock sidebar dashboard styles.
   Brand tokens from CLAUDE.md / v4_2026.css.
   Light, clean, pure-white canvas. No dark UI. No em-dashes in copy.
   ============================================================ */

:root {
  /* Surfaces */
  --surface:        #FFFFFF;   /* pure white canvas */
  --surface-alt:    #F6F8FA;   /* alt cards */
  --surface-warm:   #FEF9F1;   /* warm panel */

  /* Brand */
  --orange:         #F89939;   /* live indicator + primary accent */
  --orange-hover:   #EC8526;
  --navy:           #0E2749;   /* text + structure */
  --emerald:        #10B981;   /* answered / success */
  --teal:           #0EA5A4;

  /* Direction colors (calls) */
  --incoming:       #4978B1;
  --outgoing:       #6BB0CE;
  --missed:         #D9534F;

  /* Borders */
  --border:         #E9ECEF;
  --border-subtle:  #F0F1F4;

  /* Text */
  --text:           #0E2749;
  --text-muted:     #64748B;

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 12px;

  --font: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont,
          "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.4;
}

#app { min-height: 100vh; }

.screen { padding: 14px; }

.muted { color: var(--text-muted); }

/* ------------------------------------------------------------
   Loading + unauthorized centered states
   ------------------------------------------------------------ */
.center-stack {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 0 12px;
}

.logo-mark {
  font-weight: 700;
  font-size: 20px;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.unauth-title {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--orange);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------
   Header + Live indicator
   ------------------------------------------------------------ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.header-left { display: flex; align-items: center; gap: 8px; }

.brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.ext-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
}

/* Live pill: pulsing orange when connected, grey when not */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--orange);
  background: var(--surface-warm);
  border: 1px solid #FBE3C6;
  padding: 4px 10px;
  border-radius: 999px;
}
.live-pill[data-connected="false"] {
  color: var(--text-muted);
  background: var(--surface-alt);
  border-color: var(--border);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 0 rgba(248, 153, 57, 0.5);
  animation: pulse 1.6s ease-out infinite;
}
.live-pill[data-connected="false"] .live-dot {
  background: var(--text-muted);
  animation: none;
  box-shadow: none;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(248, 153, 57, 0.5); }
  70%  { box-shadow: 0 0 0 7px rgba(248, 153, 57, 0); }
  100% { box-shadow: 0 0 0 0 rgba(248, 153, 57, 0); }
}

/* ------------------------------------------------------------
   Stats strip
   ------------------------------------------------------------ */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.stat {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 8px;
  text-align: center;
}
.stat-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  color: var(--navy);
}
.stat-value[data-dir="incoming"] { color: var(--incoming); }
.stat-value[data-dir="outgoing"] { color: var(--outgoing); }
.stat-value[data-dir="missed"]   { color: var(--missed); }
.stat-label {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ------------------------------------------------------------
   Call sections + lists
   ------------------------------------------------------------ */
.call-section { margin-bottom: 18px; }

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.count-chip {
  font-size: 11px;
  font-weight: 700;
  color: var(--orange);
  background: var(--surface-warm);
  border: 1px solid #FBE3C6;
  border-radius: 999px;
  padding: 1px 7px;
}

.call-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.empty-note {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* ------------------------------------------------------------
   Call row
   ------------------------------------------------------------ */
.call-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 10px 12px;
  transition: border-color 0.15s ease;
}
.call-row.is-live {
  border-color: #FBE3C6;
  background: var(--surface-warm);
}

/* Direction icon puck */
.dir-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.dir-icon svg { width: 16px; height: 16px; display: block; }
.dir-icon[data-dir="incoming"] { background: var(--incoming); }
.dir-icon[data-dir="outgoing"] { background: var(--outgoing); }
.dir-icon[data-dir="missed"]   { background: var(--missed); }

.call-main { min-width: 0; }

.call-party {
  display: block;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Click-to-call number (mirrors Textdock .action-room-call) */
.call-number {
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
}
.call-number:hover { text-decoration: underline; }

.call-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
}
.call-answerer {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dot-sep::before { content: "\00B7"; margin-right: 8px; }

/* Status tag */
.status-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.status-tag[data-status="answered"]    { color: var(--emerald); background: #E7F8F1; }
.status-tag[data-status="in_progress"] { color: var(--orange);  background: var(--surface-warm); }
.status-tag[data-status="missed"]      { color: var(--missed);  background: #FBEAEA; }
.status-tag[data-status="voicemail"]   { color: var(--incoming);background: #EAF1F9; }

/* Right column: duration + playback */
.call-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.call-duration {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 13px;
  color: var(--navy);
}
.call-row.is-live .call-duration { color: var(--orange); }

/* Inline recording playback */
.call-audio {
  height: 30px;
  max-width: 180px;
}

/* ------------------------------------------------------------
   Load more
   ------------------------------------------------------------ */
.load-more {
  margin-top: 10px;
  width: 100%;
  background: var(--surface);
  color: var(--navy);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 9px 12px;
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.load-more:hover { background: var(--surface-alt); }

[hidden] { display: none !important; }
