/* Teamo call history. Private/work state and navigation changes stay scoped to Teamo. */
.tm-call-history {
  --tmch-background: #fff;
  --tmch-surface: #f5f6f9;
  --tmch-border: #d5dce7;
  --tmch-text: #111827;
  --tmch-muted: #65758a;
  --tmch-accent: #b93e22;
  --tmch-selected: #fff0e8;
  --tmch-danger: #c62828;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 16px;
  color: var(--tmch-text);
  background: var(--tmch-background);
  font: inherit;
}
.tm-call-history[data-mode="work"] {
  --tmch-background: #101010;
  --tmch-surface: #222;
  --tmch-border: #333;
  --tmch-text: #f4f4f5;
  --tmch-muted: #a3a7ae;
  --tmch-accent: #e7a082;
  --tmch-selected: #482f25;
  --tmch-danger: #ffad9f;
}
.tm-call-history *, .tm-call-history *::before, .tm-call-history *::after { box-sizing: border-box; }
.tm-call-history button, .tm-call-history select { font: inherit; }
.tm-call-history button { cursor: pointer; touch-action: manipulation; }
.tm-call-history button:disabled { cursor: default; opacity: .5; }
.tm-call-history button:focus-visible, .tm-call-history select:focus-visible {
  outline: 3px solid var(--tmch-accent);
  outline-offset: 3px;
}
.tm-call-history-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  margin: 0 0 16px;
  min-width: 0;
  border: 1px solid var(--tmch-border);
  border-radius: 17px;
  background: var(--tmch-surface);
}
.tm-call-history-mode button {
  min-width: 0;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--tmch-text);
  font-weight: 700;
}
.tm-call-history-mode button[aria-pressed="true"] { border-color: var(--tmch-accent); color: var(--tmch-accent); }
.tm-call-history-scope {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin: 0 0 8px;
  color: var(--tmch-muted);
  font-size: 13px;
  font-weight: 700;
}
.tm-call-history-scope > span { flex: 0 0 auto; }
.tm-call-history-scope select {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--tmch-text);
  background: var(--tmch-surface);
  border: 1px solid var(--tmch-border);
  border-radius: 13px;
  font-size: 14px;
  font-weight: 400;
}
.tm-call-history-context { margin: 8px 0 12px; color: var(--tmch-muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.tm-call-history-list { margin: 0; padding: 0; list-style: none; }
.tm-call-history-row {
  display: grid;
  grid-template-columns: 17px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  min-width: 0;
  padding: 18px 0;
  border-bottom: 1px solid var(--tmch-border);
}
.tm-call-history-direction { align-self: start; padding-top: 3px; color: var(--tmch-muted); }
.tm-call-history-direction svg { display: block; width: 17px; height: 17px; }
.tm-call-history-row.is-missed .tm-call-history-direction, .tm-call-history-row.is-missed .tm-call-history-outcome { color: var(--tmch-danger); }
.tm-call-history-detail { min-width: 0; line-height: 1.45; }
.tm-call-history-name { display: block; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.tm-call-history-tenant {
  display: table;
  max-width: 100%;
  margin: 3px 0;
  padding: 0 5px;
  border: 1px solid var(--tmch-border);
  border-radius: 4px;
  background: var(--tmch-surface);
  color: var(--tmch-muted);
  font-size: 10px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.tm-call-history-meta { display: flex; flex-wrap: wrap; column-gap: 4px; row-gap: 1px; margin: 3px 0; color: var(--tmch-muted); font-size: 11px; }
.tm-call-history-outcome { font-weight: 700; }
.tm-call-history-time, .tm-call-history-duration, .tm-call-history-note { margin: 3px 0 0; color: var(--tmch-muted); font-size: 11px; overflow-wrap: anywhere; }
.tm-call-history-note { font-size: 10px; }
.tm-call-history-actions { display: flex; flex-wrap: nowrap; gap: 4px; }
.tm-call-history-actions button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 0 0 48px;
  width: 48px;
  min-width: 48px;
  min-height: 62px;
  margin: 0;
  padding: 7px 4px;
  border: 1px solid var(--tmch-border);
  border-radius: 15px;
  background: var(--tmch-surface);
  color: var(--tmch-text);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 700;
}
.tm-call-history-actions button svg { display: block; width: 21px; height: 21px; color: var(--tmch-accent); }
.tm-call-history-actions button:not(:disabled):hover { border-color: var(--tmch-accent); background: var(--tmch-selected); }
.tm-call-history-callback-error { grid-column: 2 / -1; margin: 8px 0 0; color: var(--tmch-danger); font-size: 12px; overflow-wrap: anywhere; }
.tm-call-history-status, .tm-call-history-empty { margin: 20px 0; color: var(--tmch-muted); font-size: 13px; line-height: 1.6; }
.tm-call-history-error { margin: 12px 0; padding: 12px; border: 1px solid var(--tmch-border); border-radius: 12px; color: var(--tmch-danger); }
.tm-call-history-error p { margin: 0 0 8px; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.tm-call-history-error button, .tm-call-history-more {
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--tmch-border);
  border-radius: 12px;
  background: var(--tmch-surface);
  color: var(--tmch-text);
  font-size: 13px;
  font-weight: 700;
}
.tm-call-history-more { display: block; width: 100%; margin: 16px 0 4px; }
.tm-call-nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: 0 0 auto; }
.tm-call-nav-icon svg { display: block; width: 22px; height: 22px; }
@media (max-width: 359px) {
  .tm-call-history-scope { align-items: stretch; flex-direction: column; gap: 6px; }
  .tm-call-history-meta { display: block; }
  .tm-call-history-meta > span { display: block; }
}
@media (max-width: 760px) {
  .tm-app .tm-nav-items { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; min-width: 0; width: 100%; }
  .tm-app .tm-nav-items button[data-tm="section"] { min-width: 0; width: 100%; min-height: 54px; padding: 5px 2px; white-space: nowrap; font-size: 9px; line-height: 1.3; }
  .tm-app .tm-nav-items button[data-tm="section"] .tm-call-nav-icon { width: 24px; height: 24px; }
}
@media (min-width: 761px) {
  .tm-app:has([data-tm-call-history]) .tm-list { grid-column: 2 / -1; }
  .tm-app:has([data-tm-call-history]) .tm-conversation { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tm-call-history *, .tm-call-history *::before, .tm-call-history *::after { scroll-behavior: auto; transition: none; }
}
