:root {
  --crm-primary: #b88900;
  --crm-success: #15803d;
  --crm-danger: #b42318;
  --crm-warning: #b86b00;
  --crm-text: #172033;
  --crm-muted: #64748b;
  --crm-border: #dbe3ec;
  --crm-surface: #ffffff;
}

#mo-call-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1090;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column-reverse;
  gap: 12px;
  overflow-y: auto;
  padding: 2px;
  scrollbar-width: thin;
}

.mo-call-card {
  flex: 0 0 auto;
  overflow: hidden;
  background: var(--crm-surface);
  border: 1px solid var(--crm-border);
  border-left: 4px solid var(--crm-success);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .18);
  animation: mo-call-in .2s ease-out;
}

.mo-call-card[data-status="MISSED"] { border-left-color: var(--crm-danger); }
.mo-call-card[data-status="ENDED"] { border-left-color: #64748b; }
.mo-call-card[data-status="ANSWERED"],
.mo-call-card[data-status="CONNECTED"] { border-left-color: #087f8c; }

.mo-call-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 49px;
  padding: 11px 14px;
  border-bottom: 1px solid #edf1f5;
  background: #fbfcfd;
}

.mo-call-header-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #e8f5ec;
  color: var(--crm-success);
  font-size: 15px;
}

.mo-call-title {
  color: var(--crm-text);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .01em;
}

.mo-sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  margin-left: auto;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.mo-sound-toggle:hover,
.mo-sound-toggle:focus-visible {
  border-color: #94a3b8;
  background: #f1f5f9;
  color: #1e293b;
  outline: 0;
}

.mo-sound-toggle:disabled { opacity: .62; cursor: not-allowed; }

.mo-call-body { padding: 15px 16px 13px; }

.mo-caller-main {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.mo-caller-main:focus-visible {
  outline: 3px solid rgba(255, 211, 51, .55);
  outline-offset: 4px;
  border-radius: 5px;
}

.mo-customer-name {
  display: -webkit-box;
  overflow: hidden;
  color: var(--crm-text);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.mo-phone-number {
  display: inline-block;
  margin-top: 5px;
  color: #173b68;
  font-size: clamp(20px, 5vw, 23px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: .015em;
  text-decoration: none;
}

.mo-phone-number:hover { color: #0d6fb8; text-decoration: underline; }

.mo-customer-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 10px;
  margin-top: 13px;
}

.mo-customer-chip {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef6ff;
  color: #174b7a;
  font-size: 12px;
  font-weight: 800;
}

.mo-customer-chip--new { background: #fff5dc; color: #775600; }
.mo-order-summary { color: var(--crm-muted); font-size: 13px; font-weight: 600; }

.mo-call-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
}

.mo-call-actions .btn {
  min-height: 36px;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 750;
}

.mo-call-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.mo-dismiss {
  min-height: 32px;
  padding: 4px 7px;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 12px;
  font-weight: 650;
}

.mo-dismiss:hover,
.mo-dismiss:focus-visible { color: #1e293b; text-decoration: underline; outline: 0; }

.mo-status {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .025em;
}

.mo-status::before {
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.mo-status--ringing, .mo-status--dialing { background: #e8f7ed; color: #146c35; }
.mo-status--connected, .mo-status--answered { background: #e2f4f6; color: #08606a; }
.mo-status--missed { background: #fde9e7; color: #a61b13; }
.mo-status--ended { background: #e9eef3; color: #3f4d5d; }
.mo-status--default { background: #eef2f6; color: #475569; }

.mo-call-more {
  align-self: flex-end;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid #334155;
  border-radius: 999px;
  background: #334155;
  color: #fff;
  font-size: 12px;
  font-weight: 750;
}

#mo-notification-enable { position: fixed; right: 18px; top: 86px; z-index: 1030; display: none; }

.mo-history .mo-status { white-space: nowrap; }
.mo-history .mo-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.mo-history .mo-actions .btn { border-radius: 7px; font-weight: 700; }
.mo-history .table > :not(caption) > * > * { vertical-align: middle; }

@keyframes mo-call-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 575.98px) {
  #mo-call-stack { right: 10px; bottom: 10px; width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
  .mo-call-header { padding: 10px 12px; }
  .mo-call-body { padding: 13px; }
  .mo-customer-name { font-size: 18px; }
  .mo-sound-toggle span { display: none; }
  .mo-call-actions .btn { flex: 1 1 calc(50% - 4px); }
}
