/* 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; }
.tm-chat-call-row { display: flex; justify-content: flex-start; list-style: none; padding: 4px 0; min-width: 0; }
.tm-chat-call-row.is-outgoing { justify-content: flex-end; }
.tm-chat-call-bubble {
  --tmcc-accent: #aa422b;
  --tmcc-muted: #6b6572;
  --tmcc-danger: #b62734;
  display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center;
  gap: 10px; box-sizing: border-box; width: min(320px,90%); min-width: 0;
  padding: 12px; border: 1px solid #ded7d1; border-radius: 18px;
  background: #fffaf4; color: #26212a; box-shadow: 0 1px 2px #0000000a;
}
.tm-chat-call-row.is-outgoing .tm-chat-call-bubble { background: #fff0e8; }
.tm-app[data-mode="work"] .tm-chat-call-bubble {
  --tmcc-accent: #f0a284; --tmcc-muted: #c2b9b3; --tmcc-danger: #ffa7a2;
  background: #24201e; color: #fff8f3; border-color: #51443b;
}
.tm-app[data-mode="work"] .tm-chat-call-row.is-outgoing .tm-chat-call-bubble { background: #38261f; }
.tm-chat-call-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #bc6e4119; color: var(--tmcc-accent); }
.tm-chat-call-icon svg { display: block; width: 20px; height: 20px; }
.tm-chat-call-detail { display: flex; flex-direction: column; gap: 3px; min-width: 0; line-height: 1.4; }
.tm-chat-call-detail strong { font-size: 13px; font-weight: 700; }
.tm-chat-call-detail .tm-chat-call-peer { font-size: 12px; overflow-wrap: anywhere; }
.tm-chat-call-detail .tm-chat-call-outcome { font-size: 12px; color: var(--tmcc-muted); }
.tm-chat-call-detail small { color: var(--tmcc-muted); font-size: 10px; overflow-wrap: anywhere; }
.tm-chat-call-row.is-missed .tm-chat-call-icon, .tm-chat-call-row.is-missed .tm-chat-call-outcome { color: var(--tmcc-danger); }
.tm-chat-call-bubble > button {
  display: grid; place-items: center; width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  padding: 10px; border: 1px solid #bc6e4145; border-radius: 14px;
  background: transparent; color: var(--tmcc-accent); cursor: pointer; touch-action: manipulation;
}
.tm-chat-call-bubble > button svg { display: block; width: 22px; height: 22px; }
.tm-chat-call-bubble > button:focus-visible { outline: 3px solid var(--tmcc-accent); outline-offset: 2px; }
.tm-chat-call-bubble > button:disabled { opacity: .5; cursor: default; }
.tm-chat-call-notice { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; padding: 7px; list-style: none; color: var(--tm-muted,#737373); font-size: 12px; text-align: center; }
.tm-chat-call-error { grid-column: 1 / -1; margin: 4px 0 0; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; color: var(--tmcc-danger,#b62734); }
.tm-app[data-mode="work"] .tm-chat-call-notice.tm-chat-call-error { color: #ffa7a2; }
@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; }
}
